From 3907149259cfa644028f8fb55c616dc0ae7162bd Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 9 Jul 2023 09:05:41 +0000 Subject: [PATCH 1/3] new type of action --- src/Platform/Action.php | 2 ++ 1 file changed, 2 insertions(+) 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 = []; From fa29008a786800821f35579c043e29072bcd614a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 9 Jul 2023 09:26:28 +0000 Subject: [PATCH 2/3] init worker hook --- src/Platform/Platform.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Platform/Platform.php b/src/Platform/Platform.php index f13679d..8a0c0b6 100644 --- a/src/Platform/Platform.php +++ b/src/Platform/Platform.php @@ -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(); From e770add70a6fcdd4757dd5b0e58470ff67aaf0e2 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 9 Jul 2023 09:39:11 +0000 Subject: [PATCH 3/3] check key contains worker name --- src/Platform/Platform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Platform/Platform.php b/src/Platform/Platform.php index 8a0c0b6..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; }