This commit is contained in:
as2252258@163.com
2021-04-07 02:31:43 +08:00
parent 964ce69eca
commit 1ff368b199
3 changed files with 38 additions and 25 deletions
+12 -1
View File
@@ -50,7 +50,8 @@ class ServerInotify extends Process
*/
public function getLoader()
{
return $this->getLoader();
$annotation = Snowflake::app()->getAnnotation();
return $annotation->getLoader();
}
@@ -73,6 +74,16 @@ class ServerInotify extends Process
if (!is_dir($dir)) continue;
$this->watch($dir);
}
$worker = Snowflake::app()->getSwoole();
$workerNum = $worker->setting['worker_num'];
$task_worker_num = $worker->setting['task_worker_num'] ?? 0;
for ($i = 0; $i < $workerNum + $task_worker_num; $i++) {
$worker->sendMessage(['reload', $this->getLoader()], $i);
}
Event::add($this->inotify, [$this, 'check']);
Event::wait();
} else {