diff --git a/app/lib/App/SSE/EventLoop.php b/app/lib/App/SSE/EventLoop.php index f9093c3..ada973c 100644 --- a/app/lib/App/SSE/EventLoop.php +++ b/app/lib/App/SSE/EventLoop.php @@ -12,7 +12,7 @@ class EventLoop public int $interval = 3; public int $heartbeat = 5; // send heartbeat every num seconds to ensure connection is still alive - public int $timeLimit = 3600; + public int $timeLimit = 3; public int $execLimit = 30; public function start(callable $callback): void @@ -34,9 +34,11 @@ class EventLoop ob_end_flush(); flush(); + $expirationTime = time() + $this->timeLimit; + $lastHeartbeat = time(); - while (!connection_aborted() && time() < (time() + $this->timeLimit)) + while (!connection_aborted() && time() < $expirationTime) { set_time_limit($this->execLimit); try {