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

Fix SlackHandler bug where slack drops some messages if the socket is closed too early, fixes #729

This commit is contained in:
Jordi Boggiano
2016-03-07 12:29:57 +00:00
parent d68b63a0d0
commit 5085630fd6
2 changed files with 12 additions and 0 deletions

View File

@@ -241,6 +241,10 @@ class SlackHandler extends SocketHandler
protected function write(array $record)
{
parent::write($record);
$res = $this->getResource();
if (is_resource($res)) {
@fread($res, 2048);
}
$this->closeSocket();
}

View File

@@ -255,6 +255,14 @@ class SocketHandler extends AbstractProcessingHandler
return (string) $record['formatted'];
}
/**
* @return resource|null
*/
protected function getResource()
{
return $this->resource;
}
private function connect()
{
$this->createSocketResource();