1
0
Fork 0
mirror of synced 2024-09-30 09:18:14 +13:00

feat: merge conflicts

This commit is contained in:
Christy Jacob 2022-01-31 18:43:11 +04:00
parent b1a659be77
commit 0de8ff6d41
2 changed files with 9 additions and 9 deletions

View file

@ -962,7 +962,7 @@ App::delete('/v1/functions/:functionId')
->action( ->action(
function (string $functionId, string $projectId, Response $response, Database $dbForProject) use ($orchestrationPool) { function (string $functionId, string $projectId, Response $response, Database $dbForProject) use ($orchestrationPool) {
$results = $dbForProject->find('deployments', [new Query('functionId', Query::TYPE_EQUAL, [$functionId])], 999); $results = $dbForProject->find('deployments', [new Query('resourceId', Query::TYPE_EQUAL, [$functionId])], 999);
// If amount is 0 then we simply return true // If amount is 0 then we simply return true
if (count($results) === 0) { if (count($results) === 0) {
@ -975,19 +975,19 @@ App::delete('/v1/functions/:functionId')
global $register; global $register;
foreach ($results as $deployment) { foreach ($results as $deployment) {
go(function () use ($orchestrationPool, $deployment, $register, $projectId) { go(function () use ($orchestrationPool, $deployment, $register, $projectId) {
$db = $register->get('dbPool')->get();
$redis = $register->get('redisPool')->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);
try { try {
$orchestration = $orchestrationPool->get(); $orchestration = $orchestrationPool->get();
// Remove the container of the deployment // Remove the container of the deployment
$orchestration->remove('appwrite-function-' . $deployment['$id'], true); $orchestration->remove('appwrite-function-' . $deployment['$id'], true);
Console::success('Removed container for deployment: ' . $deployment['$id']); Console::success('Removed container for deployment: ' . $deployment['$id']);
$db = $register->get('dbPool')->get();
$redis = $register->get('redisPool')->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);
$builds = $dbForProject->find('builds', [ $builds = $dbForProject->find('builds', [
new Query('deploymentId', Query::TYPE_EQUAL, [$deployment['$id']]), new Query('deploymentId', Query::TYPE_EQUAL, [$deployment['$id']]),
new Query('status', Query::TYPE_EQUAL, ['building']) new Query('status', Query::TYPE_EQUAL, ['building'])

View file

@ -348,7 +348,7 @@ class DeletesV1 extends Worker
$storageFunctions = new Local(APP_STORAGE_FUNCTIONS . '/app-' . $projectId); $storageFunctions = new Local(APP_STORAGE_FUNCTIONS . '/app-' . $projectId);
$deploymentIds = []; $deploymentIds = [];
$this->deleteByGroup('deployments', [ $this->deleteByGroup('deployments', [
new Query('functionId', Query::TYPE_EQUAL, [$document->getId()]) new Query('resourceId', Query::TYPE_EQUAL, [$document->getId()])
], $dbForProject, function (Document $document) use ($storageFunctions, &$deploymentIds) { ], $dbForProject, function (Document $document) use ($storageFunctions, &$deploymentIds) {
$deploymentIds[] = $document->getId(); $deploymentIds[] = $document->getId();
if ($storageFunctions->delete($document->getAttribute('path', ''), true)) { if ($storageFunctions->delete($document->getAttribute('path', ''), true)) {