From 939d2f41a86ba481cf3c01ffc3e0bcdd1b6a98ea Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 29 May 2026 10:54:24 +0530 Subject: [PATCH] Revert "Fix deployment cancel race in build worker" This reverts commit 902b1d580e0fbd9f71a33b1816673a1f2a466a9a. --- .../Modules/Functions/Workers/Builds.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 95756addce..f04f7c3807 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -246,18 +246,14 @@ class Builds extends Action ->setParam($resourceKey, $resource->getId()) ->setParam('deploymentId', $deployment->getId()); - $deploymentId = $deployment->getId(); - $deployment = $dbForProject->getDocument('deployments', $deploymentId); - if ($deployment->isEmpty()) { - throw new \Exception('Deployment not found'); - } - if ($deployment->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deploymentId, $dbForProject, $queueForRealtime); + $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } + $deploymentId = $deployment->getId(); + $deployment->setAttribute('buildStartedAt', $startTime); $deployment->setAttribute('status', 'processing'); $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ @@ -538,12 +534,6 @@ class Builds extends Action } /** Request the executor to build the code... */ - $deployment = $dbForProject->getDocument('deployments', $deploymentId); - if ($deployment->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deploymentId, $dbForProject, $queueForRealtime); - return; - } - $deployment->setAttribute('status', 'building'); $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ 'status' => 'building',