Commit
This commit is contained in:
parent
800b6d6b34
commit
1c431c86e7
@ -12,7 +12,7 @@ class EventLoop
|
|||||||
public int $interval = 3;
|
public int $interval = 3;
|
||||||
|
|
||||||
public int $heartbeat = 5; // send heartbeat every num seconds to ensure connection is still alive
|
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 int $execLimit = 30;
|
||||||
|
|
||||||
public function start(callable $callback): void
|
public function start(callable $callback): void
|
||||||
@ -34,9 +34,11 @@ class EventLoop
|
|||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
|
$expirationTime = time() + $this->timeLimit;
|
||||||
|
|
||||||
$lastHeartbeat = time();
|
$lastHeartbeat = time();
|
||||||
|
|
||||||
while (!connection_aborted() && time() < (time() + $this->timeLimit))
|
while (!connection_aborted() && time() < $expirationTime)
|
||||||
{
|
{
|
||||||
set_time_limit($this->execLimit);
|
set_time_limit($this->execLimit);
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user