瀏覽代碼

Avoid collecting duplicate logs if the file cannot be locked

Jordi Boggiano 9 月之前
父節點
當前提交
2e97231b96
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/Monolog/Handler/DeduplicationHandler.php

+ 3 - 1
src/Monolog/Handler/DeduplicationHandler.php

@@ -148,7 +148,9 @@ class DeduplicationHandler extends BufferHandler
             throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore);
         }
 
-        flock($handle, LOCK_EX);
+        if (false === flock($handle, LOCK_EX)) {
+            return;
+        }
         $validLogs = [];
 
         $timestampValidity = time() - $this->time;