From 280a44e1cd2e3dd0e35d3be5b0ae0ee60c59c00f Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Tue, 15 Nov 2022 17:55:30 +0100 Subject: [PATCH] Fix bugs during QA --- app/workers/deletes.php | 26 ++------------ app/workers/functions.php | 13 ++++--- bin/worker-functions | 2 +- composer.lock | 72 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 79 insertions(+), 34 deletions(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 0134fad66d..3e0df8ce38 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -468,19 +468,7 @@ class DeletesV1 extends Worker Query::equal('functionId', [$functionId]) ], $dbForProject); - /** - * Request executor to delete all deployment containers - * TODO: Re-enable. Disabled for now because of proxy. Container killed after inactivity automatically. - */ - // Console::info("Requesting executor to delete all deployment containers for function " . $functionId); - // $executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); - // foreach ($deploymentIds as $deploymentId) { - // try { - // $executor->deleteRuntime($projectId, $deploymentId); - // } catch (Throwable $th) { - // Console::error($th->getMessage()); - // } - // } + // TODO: Request executor to delete runtime } /** @@ -520,17 +508,7 @@ class DeletesV1 extends Worker } }); - /** - * Request executor to delete the deployment container. - * TODO: Re-enable. Disabled for now because of proxy. Container killed after inactivity automatically. - */ - // Console::info("Requesting executor to delete deployment container for deployment " . $deploymentId); - // try { - // $executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); - // $executor->deleteRuntime($projectId, $deploymentId); - // } catch (Throwable $th) { - // Console::error($th->getMessage()); - // } + // TODO: Request executor to delete runtime } diff --git a/app/workers/functions.php b/app/workers/functions.php index 8a3940de8a..2d7f4565c4 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -164,14 +164,13 @@ $execute = function ( try { $executionResponse = $executor->createExecution( projectId: $project->getId(), - deploymentId: $deploymentId, - path: $build->getAttribute('outputPath', ''), - vars: $vars, + deploymentId: $deployment->getId(), + payload: $vars['APPWRITE_FUNCTION_DATA'] ?? '', + variables: $vars, + timeout: $function->getAttribute('timeout', 0), + image: $runtime['image'], + source: $build->getAttribute('outputPath', ''), entrypoint: $deployment->getAttribute('entrypoint', ''), - data: $vars['APPWRITE_FUNCTION_DATA'] ?? '', - runtime: $function->getAttribute('runtime', ''), - baseImage: $runtime['image'], - timeout: $function->getAttribute('timeout', 0) ); /** Update execution status */ diff --git a/bin/worker-functions b/bin/worker-functions index 143b431b0c..b22ee65d39 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,3 +1,3 @@ #!/bin/sh -php php /usr/src/code/app/workers/functions.php $@ \ No newline at end of file +php /usr/src/code/app/workers/functions.php $@ \ No newline at end of file diff --git a/composer.lock b/composer.lock index f042279e4f..3912636eea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b125039c64ae4cbe0d2a1b57322d0ebe", + "content-hash": "3e24f0f02ec826898d50e4119f9eb226", "packages": [ { "name": "adhocore/jwt", @@ -2357,6 +2357,67 @@ }, "time": "2020-10-24T07:04:59+00:00" }, + { + "name": "utopia-php/queue", + "version": "dev-upgrade-libs", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/queue.git", + "reference": "310aaac74d2287d3d9450a532658247cdfe5e72c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/310aaac74d2287d3d9450a532658247cdfe5e72c", + "reference": "310aaac74d2287d3d9450a532658247cdfe5e72c", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "utopia-php/cli": "0.14.*", + "utopia-php/framework": "0.*.*" + }, + "require-dev": { + "laravel/pint": "^0.2.3", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5.5", + "swoole/ide-helper": "4.8.8", + "workerman/workerman": "^4.0" + }, + "suggest": { + "ext-swoole": "Needed to support Swoole.", + "workerman/workerman": "Needed to support Workerman." + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Queue\\": "src/Queue" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Torsten Dittmann", + "email": "torsten@appwrite.io" + } + ], + "description": "A powerful task queue.", + "keywords": [ + "Tasks", + "framework", + "php", + "queue", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/queue/issues", + "source": "https://github.com/utopia-php/queue/tree/upgrade-libs" + }, + "time": "2022-11-15T16:35:56+00:00" + }, { "name": "utopia-php/registry", "version": "dev-feat-allow-params", @@ -5216,6 +5277,12 @@ } ], "aliases": [ + { + "package": "utopia-php/queue", + "version": "dev-upgrade-libs", + "alias": "0.4.1", + "alias_normalized": "0.4.1.0" + }, { "package": "utopia-php/registry", "version": "dev-feat-allow-params", @@ -5225,6 +5292,7 @@ ], "minimum-stability": "stable", "stability-flags": { + "utopia-php/queue": 20, "utopia-php/registry": 20 }, "prefer-stable": false, @@ -5250,5 +5318,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.1.0" }