This commit is contained in:
as2252258@163.com
2021-04-08 00:07:18 +08:00
parent d1a5a85d31
commit ee0db4c6c9
+6 -2
View File
@@ -39,14 +39,18 @@ class OnWorkerStart extends Callback
name($server->worker_pid, $worker_id >= $server->setting['worker_num'] ? 'task' : 'worker');
$annotation = Snowflake::app()->getAnnotation();
/** @var Loader $runtime */
$runtime = unserialize(file_get_contents(storage('runtime.php')));
$annotation->setLoader($runtime);
if ($worker_id >= $server->setting['worker_num']) {
$runtime->loadByDirectory(MODEL_PATH);
$annotation->instanceDirectoryFiles(MODEL_PATH);
$this->onTask($server, $worker_id);
} else {
$runtime->loadByDirectory(APP_PATH);
$annotation->instanceDirectoryFiles(APP_PATH);
$this->onWorker($server, $worker_id);
}