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

Fix hipchat dropping messages, fixes #1116

This commit is contained in:
Jordi Boggiano
2018-06-18 17:37:57 +02:00
parent 7c549e383c
commit ee10777821
2 changed files with 16 additions and 0 deletions

View File

@@ -219,6 +219,21 @@ class HipChatHandler extends SocketHandler
protected function write(array $record)
{
parent::write($record);
$this->finalizeWrite();
}
/**
* Finalizes the request by reading some bytes and then closing the socket
*
* If we do not read some but close the socket too early, hipchat sometimes
* drops the request entirely.
*/
protected function finalizeWrite()
{
$res = $this->getResource();
if (is_resource($res)) {
@fread($res, 2048);
}
$this->closeSocket();
}