modify
This commit is contained in:
@@ -53,27 +53,32 @@ class OnWorkerStart extends Callback
|
|||||||
*/
|
*/
|
||||||
public function onHandler(Server $server, int $worker_id): void
|
public function onHandler(Server $server, int $worker_id): void
|
||||||
{
|
{
|
||||||
$annotation = $this->injectLoader();
|
(new Pipeline())
|
||||||
$line = new Pipeline();
|
->if($this->isWorker($worker_id), function ($handler, $server, $worker_id) {
|
||||||
$line->if($this->isWorker($worker_id), function ($annotation, $server, $worker_id) {
|
$annotation = Snowflake::app()->getAnnotation();
|
||||||
$annotation->runtime(CONTROLLER_PATH);
|
|
||||||
$annotation->runtime(APP_PATH, CONTROLLER_PATH);
|
$annotation->runtime(CONTROLLER_PATH);
|
||||||
$this->onWorker($server, $server->worker_id);
|
$annotation->runtime(APP_PATH, CONTROLLER_PATH);
|
||||||
name($server->worker_pid, 'Worker.' . $worker_id);
|
$handler->onWorker($server, $server->worker_id);
|
||||||
})
|
name($server->worker_pid, 'Worker.' . $worker_id);
|
||||||
->else(function ($annotation, $server, $worker_id) {
|
})
|
||||||
|
->else(function ($handler, $server, $worker_id) {
|
||||||
|
$annotation = Snowflake::app()->getAnnotation();
|
||||||
$annotation->runtime(MODEL_PATH);
|
$annotation->runtime(MODEL_PATH);
|
||||||
$this->onTask($server, $server->worker_id);
|
|
||||||
|
$handler->onTask($server, $server->worker_id);
|
||||||
name($server->worker_pid, 'Task.' . $worker_id);
|
name($server->worker_pid, 'Task.' . $worker_id);
|
||||||
})
|
})
|
||||||
->catch(function (\Throwable $throwable) {
|
->catch(function (\Throwable $throwable) {
|
||||||
$this->addError($throwable->getMessage());
|
logger()->addError($throwable->getMessage());
|
||||||
})
|
})
|
||||||
->before(function ($annotation, $server, $worker_id) {
|
->before(function ($annotation, $server, $worker_id) {
|
||||||
putenv('state=start');
|
putenv('state=start');
|
||||||
putenv('worker=' . $worker_id);
|
putenv('worker=' . $worker_id);
|
||||||
|
|
||||||
|
$this->injectLoader();
|
||||||
})
|
})
|
||||||
->exec($annotation, $server, $worker_id);
|
->exec($this, $server, $worker_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user