From ada1f2abb7400663c8305289a271154d35dcfba8 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Mon, 19 Feb 2024 00:44:21 +0530 Subject: [PATCH] Mark cancelled first, then kill container --- app/controllers/api/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 2e3aff0867..1fdfdeecc1 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1513,11 +1513,11 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId' throw new Exception(Exception::BUILD_NOT_FOUND); } + $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('status', 'cancelled')); + $executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $deleteBuild = $executor->deleteRuntime($project->getId(), $deploymentId . "-build"); - $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('status', 'cancelled')); - $queueForEvents ->setParam('functionId', $function->getId()) ->setParam('deploymentId', $deployment->getId());