diff --git a/src/utils/MainLoggerThread.php b/src/utils/MainLoggerThread.php index f6fae75eb3..49b98c1c40 100644 --- a/src/utils/MainLoggerThread.php +++ b/src/utils/MainLoggerThread.php @@ -50,10 +50,11 @@ final class MainLoggerThread extends \Thread{ } public function syncFlushBuffer() : void{ - $this->syncFlush = true; $this->synchronized(function() : void{ + $this->syncFlush = true; $this->notify(); //write immediately - + }); + $this->synchronized(function() : void{ while($this->syncFlush){ $this->wait(); //block until it's all been written to disk } @@ -95,7 +96,7 @@ final class MainLoggerThread extends \Thread{ while(!$this->shutdown){ $this->writeLogStream($logResource); $this->synchronized(function() : void{ - if(!$this->shutdown){ + if(!$this->shutdown && !$this->syncFlush){ $this->wait(); } });