diff --git a/app/lib/App/SSE/EventLoop.php b/app/lib/App/SSE/EventLoop.php index f2767f7..4c0af69 100644 --- a/app/lib/App/SSE/EventLoop.php +++ b/app/lib/App/SSE/EventLoop.php @@ -24,19 +24,20 @@ class EventLoop session_write_close(); } - header("Cache-Control: no-store"); - header("Content-Type: text/event-stream"); - header('X-Accel-Buffering: no'); // for nginx buffering + header('Cache-Control: no-store, must-revalidate'); + header('Content-Type: text/event-stream'); + // explicitly disable caching so varnish and other upstreams won't cache. + header('Cache-Control: no-cache, must-revalidate'); + // instruct nginx to disable fastcgi_buffering and disable gzip + header('X-Accel-Buffering: no'); // send headers to client indicating we are now a stream ob_end_flush(); flush(); - $expirationTime = time() + $this->timeLimit; - $lastHeartbeat = time(); - while (!connection_aborted() && time() < $expirationTime) + while (!connection_aborted() && time() < (time() + $this->timeLimit)) { set_time_limit($this->execLimit); try {