diff options
author | Jordi Boggiano <j.boggiano@seld.be> | 2017-03-17 22:49:31 +0100 |
---|---|---|
committer | Jordi Boggiano <j.boggiano@seld.be> | 2017-03-17 22:58:02 +0100 |
commit | 25da38373af6f3b578001ea76c4a2f16451bd6d0 (patch) | |
tree | 7b2c236bc1d1936960266bdeae3e3b17fa72b9af | |
parent | e481c9db10c502193e184e678930a23a04f635d5 (diff) | |
download | monolog-25da38373af6f3b578001ea76c4a2f16451bd6d0.zip monolog-25da38373af6f3b578001ea76c4a2f16451bd6d0.tar.gz monolog-25da38373af6f3b578001ea76c4a2f16451bd6d0.tar.bz2 |
Split off work into a new method to facilitate extension, fixes #945
-rw-r--r-- | src/Monolog/Handler/SlackHandler.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Monolog/Handler/SlackHandler.php b/src/Monolog/Handler/SlackHandler.php index 9324fc9..3ac4d83 100644 --- a/src/Monolog/Handler/SlackHandler.php +++ b/src/Monolog/Handler/SlackHandler.php @@ -144,6 +144,17 @@ class SlackHandler 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, slack sometimes + * drops the request entirely. + */ + protected function finalizeWrite() + { $res = $this->getResource(); if (is_resource($res)) { @fread($res, 2048); |