1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-30 08:21:05 +02:00

add support to define writetimeout in ms

This commit is contained in:
milos
2020-11-30 17:40:22 +01:00
parent 39637a5d0e
commit 1106f259c2

View File

@@ -352,10 +352,11 @@ class SocketHandler extends AbstractProcessingHandler
} }
} }
private function writingIsTimedOut(int $sent): bool private function writingIsTimedOut($sent)
{ {
$writingTimeout = (int) floor($this->writingTimeout); // convert to ms
if (0 === $writingTimeout) { $writingTimeoutMs = $this->writingTimeout * 1000;
if (0 === $writingTimeoutMs) {
return false; return false;
} }
@@ -368,7 +369,10 @@ class SocketHandler extends AbstractProcessingHandler
usleep(100); usleep(100);
} }
if ((time() - $this->lastWritingAt) >= $writingTimeout) { // convert to ms
$lastWritingMs = (time() - $this->lastWritingAt) * 1000;
if ($lastWritingMs >= $writingTimeoutMs) {
$this->closeSocket(); $this->closeSocket();
return true; return true;