Bladeren bron

Avoid collecting duplicate logs if the file cannot be locked

Jordi Boggiano 9 maanden geleden
bovenliggende
commit
2e97231b96
1 gewijzigde bestanden met toevoegingen van 3 en 1 verwijderingen
  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);
             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 = [];
         $validLogs = [];
 
 
         $timestampValidity = time() - $this->time;
         $timestampValidity = time() - $this->time;