diff --git a/app/worker.php b/app/worker.php index 49805f9c88..58bbbdcc74 100644 --- a/app/worker.php +++ b/app/worker.php @@ -274,6 +274,9 @@ $worker Console::error('[Error] Line: ' . $error->getLine()); }); +// We need to add `getWorkerStartHook` in `utopia-php/queue` so that we can check if +// we have already added workerStart hook, if not we can add this default worker start hook here + // $worker->workerStart() // ->action(function () use ($workerName) { // Console::info("Worker $workerName started"); diff --git a/bin/worker-usage b/bin/worker-usage index 9d325ac46e..e39ce8477c 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,3 +1,3 @@ #!/bin/sh -QUEUE=v1-usage php /usr/src/code/app/workers/usage.php $@ \ No newline at end of file +php /usr/src/code/app/worker.php usage $@ \ No newline at end of file diff --git a/composer.lock b/composer.lock index 17cba0ba0c..42983b3153 100644 --- a/composer.lock +++ b/composer.lock @@ -1950,12 +1950,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "fa29008a786800821f35579c043e29072bcd614a" + "reference": "e770add70a6fcdd4757dd5b0e58470ff67aaf0e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/fa29008a786800821f35579c043e29072bcd614a", - "reference": "fa29008a786800821f35579c043e29072bcd614a", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/e770add70a6fcdd4757dd5b0e58470ff67aaf0e2", + "reference": "e770add70a6fcdd4757dd5b0e58470ff67aaf0e2", "shasum": "" }, "require": { @@ -1992,7 +1992,7 @@ "issues": "https://github.com/utopia-php/platform/issues", "source": "https://github.com/utopia-php/platform/tree/integrate-workers-dl" }, - "time": "2023-07-09T09:26:28+00:00" + "time": "2023-07-09T09:39:11+00:00" }, { "name": "utopia-php/pools", diff --git a/src/Appwrite/Platform/Services/Workers.php b/src/Appwrite/Platform/Services/Workers.php index 6ad47e32bb..add59dbc84 100644 --- a/src/Appwrite/Platform/Services/Workers.php +++ b/src/Appwrite/Platform/Services/Workers.php @@ -13,6 +13,7 @@ use Appwrite\Platform\Workers\Functions; use Appwrite\Platform\Workers\Builds; use Appwrite\Platform\Workers\Deletes; use Appwrite\Platform\Workers\Usage; +use Appwrite\Platform\Workers\UsageHook; class Workers extends Service { @@ -29,7 +30,8 @@ class Workers extends Service ->addAction(Functions::getName(), new Functions()) ->addAction(Builds::getName(), new Builds()) ->addAction(Deletes::getName(), new Deletes()) - //->addAction(Usage::getName(), new Usage()) + ->addAction(Usage::getName(), new Usage()) + ->addAction(UsageHook::getName(), new UsageHook()) ; } } diff --git a/src/Appwrite/Platform/Workers/UsageHook.php b/src/Appwrite/Platform/Workers/UsageHook.php index 0937f3a628..a4787e3181 100644 --- a/src/Appwrite/Platform/Workers/UsageHook.php +++ b/src/Appwrite/Platform/Workers/UsageHook.php @@ -22,7 +22,7 @@ class UsageHook extends Usage { public static function getName(): string { - return 'usage'; + return 'usageHook'; } public function action($register, $cache, $pools): void