This commit is contained in:
William 2022-03-28 08:46:02 +00:00
parent 1a68caced4
commit 88d7cabacb

View File

@ -24,19 +24,20 @@ class EventLoop
session_write_close(); session_write_close();
} }
header("Cache-Control: no-store"); header('Cache-Control: no-store, must-revalidate');
header("Content-Type: text/event-stream"); header('Content-Type: text/event-stream');
header('X-Accel-Buffering: no'); // for nginx buffering // 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 // send headers to client indicating we are now a stream
ob_end_flush(); ob_end_flush();
flush(); flush();
$expirationTime = time() + $this->timeLimit;
$lastHeartbeat = time(); $lastHeartbeat = time();
while (!connection_aborted() && time() < $expirationTime) while (!connection_aborted() && time() < (time() + $this->timeLimit))
{ {
set_time_limit($this->execLimit); set_time_limit($this->execLimit);
try { try {