From 1c431c86e7eb06da1ff99221b0c97bdb5b6c164c Mon Sep 17 00:00:00 2001 From: William Date: Mon, 28 Mar 2022 15:22:54 +0000 Subject: [PATCH] Commit --- app/lib/App/SSE/EventLoop.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 {