[Jifty-commit] r7034 - jifty/trunk/share/web/templates/=

Jifty commits jifty-commit at lists.jifty.org
Thu May 14 14:25:05 EDT 2009


Author: alexmv
Date: Thu May 14 14:25:04 2009
New Revision: 7034

Modified:
   jifty/trunk/share/web/templates/=/subs

Log:
Every 10 seconds, have PubSub send a whitespace character as a keep-alive

Without this, Pubsub children under a Forking server stick around
forever after the client has left the page.  This does not address the
problem of FastCGI clients, which have a similar problem.

Modified: jifty/trunk/share/web/templates/=/subs
==============================================================================
--- jifty/trunk/share/web/templates/=/subs	(original)
+++ jifty/trunk/share/web/templates/=/subs	Thu May 14 14:25:04 2009
@@ -25,10 +25,18 @@
 
 $m->print($begin);
 $m->flush_buffer;
+Jifty->handler->buffer->flush_output;
 $writer->startTag("body");
 
+local $SIG{PIPE} = sub {
+    die "ABORT";
+};
+
+my $loops;
 while (Jifty->config->framework('PubSub')->{'Enable'}) {
+    Jifty->web->out(" ") if ++$loops % 10 == 0;
     my $sent = write_subs_once($writer);
+    Jifty->handler->buffer->flush_output;
     flush STDOUT;
     last if ( $sent && !$forever );
     sleep 1;


More information about the Jifty-commit mailing list