diff --git a/src/Platform/Action.php b/src/Platform/Action.php index 764b2ed..4c628d2 100644 --- a/src/Platform/Action.php +++ b/src/Platform/Action.php @@ -37,6 +37,8 @@ abstract class Action public const TYPE_OPTIONS = 'Options'; + public const TYPE_WORKER_START = 'WorkerStart'; + protected ?string $desc = null; protected array $groups = []; diff --git a/src/Platform/Platform.php b/src/Platform/Platform.php index f13679d..98fcc97 100644 --- a/src/Platform/Platform.php +++ b/src/Platform/Platform.php @@ -174,7 +174,7 @@ protected function initWorker(array $params): void $this->worker ??= new Server($adapter); foreach ($this->services[Service::TYPE_WORKER] as $service) { foreach ($service->getActions() as $key => $action) { - if($workerName !== strtolower($key)){ + if(!str_contains(strtolower($key), $workerName)){ continue; } @@ -188,6 +188,9 @@ protected function initWorker(array $params): void case Action::TYPE_SHUTDOWN: $hook = $this->worker->shutdown(); break; + case Action::TYPE_WORKER_START: + $hook = $this->worker->workerStart(); + break; case Action::TYPE_DEFAULT: default: $hook = $this->worker->job();