This commit is contained in:
as2252258@163.com
2021-04-09 03:07:40 +08:00
parent ef7dc2980e
commit f3e0f76881
+1 -3
View File
@@ -56,18 +56,16 @@ class OnWorkerStart extends Callback
(new Pipeline()) (new Pipeline())
->if($this->isWorker($worker_id), function ($handler, $server, $worker_id) { ->if($this->isWorker($worker_id), function ($handler, $server, $worker_id) {
$annotation = Snowflake::app()->getAnnotation(); $annotation = Snowflake::app()->getAnnotation();
$annotation->runtime(CONTROLLER_PATH); $annotation->runtime(CONTROLLER_PATH);
$annotation->runtime(APP_PATH, CONTROLLER_PATH); $annotation->runtime(APP_PATH, CONTROLLER_PATH);
$handler->onWorker($server, $server->worker_id); $handler->onWorker($server, $server->worker_id);
name($server->worker_pid, 'Worker.' . $worker_id);
}) })
->else(function ($handler, $server, $worker_id) { ->else(function ($handler, $server, $worker_id) {
$annotation = Snowflake::app()->getAnnotation(); $annotation = Snowflake::app()->getAnnotation();
$annotation->runtime(MODEL_PATH); $annotation->runtime(MODEL_PATH);
$handler->onTask($server, $server->worker_id); $handler->onTask($server, $server->worker_id);
name($server->worker_pid, 'Task.' . $worker_id);
}) })
->catch(function (\Throwable $throwable) { ->catch(function (\Throwable $throwable) {
logger()->addError($throwable->getMessage()); logger()->addError($throwable->getMessage());