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