From c5829ec871f60acaeb55d135d2514495e79e0e8e Mon Sep 17 00:00:00 2001 From: dmitry krokhin Date: Wed, 2 Feb 2022 12:18:51 +0300 Subject: [PATCH] processing timeout fix --- src/Client.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 8de9b91..c13a1eb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -216,10 +216,11 @@ public function process(null|int|float $timeout = 0) $max = microtime(true) + $timeout; while (!($line = stream_get_line($this->socket, 1024, "\r\n"))) { - if (microtime(true) > $max) { + $now = microtime(true); + if ($now >= $max) { return null; } - // 1ms sleep + $this->logger?->debug('sleep', compact('max', 'now')); usleep(intval($this->delay * 1_000_000)); }