summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Monolog/Handler/SlackHandler.php11
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);