Kaynağa Gözat

Update Worker.php

walkor 3 yıl önce
ebeveyn
işleme
d73f172d74
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      src/Worker.php

+ 3 - 1
src/Worker.php

@@ -545,11 +545,13 @@ class Worker
     {
         static::checkSapiEnv();
         static::init();
+        static::lock();
         static::parseCommand();
         static::daemonize();
         static::initWorkers();
         static::installSignal();
         static::saveMasterPid();
+        static::unlock();
         static::displayUI();
         static::forkWorkers();
         static::resetStd();
@@ -628,7 +630,7 @@ class Worker
      */
     protected static function lock()
     {
-        $fd = \fopen(static::$_startFile, 'r');
+        $fd = \fopen(static::$_startFile, 'a+');
         if ($fd && !flock($fd, LOCK_EX)) {
             static::log('Workerman['.static::$_startFile.'] already running.');
             exit;