From a4e3eb07d85c9965f77821b42c0dddd25647c4cd Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 28 Jan 2022 16:26:22 +0400 Subject: [PATCH] feat: put db and redis workers back in the pool --- app/executor.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/executor.php b/app/executor.php index 1e4ceee126..537767d2e6 100644 --- a/app/executor.php +++ b/app/executor.php @@ -972,12 +972,13 @@ App::delete('/v1/functions/:functionId') try { $db = $register->get('dbPool')->get(); $redis = $register->get('redisPool')->get(); + $orchestration = $orchestrationPool->get(); + $cache = new Cache(new RedisCache($redis)); $dbForProject = new Database(new MariaDB($db), $cache); $dbForProject->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $dbForProject->setNamespace('_project_' . $projectId); - $orchestration = $orchestrationPool->get(); // Remove any ongoing builds if ($deployment->getAttribute('buildId')) { $build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId')); @@ -996,6 +997,8 @@ App::delete('/v1/functions/:functionId') Console::error($th->getMessage()); } finally { $orchestrationPool->put($orchestration); + $register->get('dbPool')->put($db); + $register->get('redisPool')->put($redis); } }); } @@ -1059,12 +1062,13 @@ App::delete('/v1/deployments/:deploymentId') try { $db = $register->get('dbPool')->get(); $redis = $register->get('redisPool')->get(); + $orchestration = $orchestrationPool->get(); + $cache = new Cache(new RedisCache($redis)); $dbForProject = new Database(new MariaDB($db), $cache); $dbForProject->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $dbForProject->setNamespace('_project_' . $projectId); - $orchestration = $orchestrationPool->get(); // Remove any ongoing builds if ($deployment->getAttribute('buildId')) { $build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId')); @@ -1084,6 +1088,8 @@ App::delete('/v1/deployments/:deploymentId') Console::error($th->getMessage()); } finally { $orchestrationPool->put($orchestration); + $register->get('dbPool')->put($db); + $register->get('redisPool')->put($redis); } });