From 6e5324692940e007db72b42c4615f91b632c604b Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 9 Sep 2026 16:24:23 +0100 Subject: [PATCH] fix: stop legacy duration at the recorded build end --- src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php b/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php index f1b7f27302..595f2872a4 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php @@ -676,13 +676,16 @@ class Jobs extends Action try { $started = (float) (new \DateTimeImmutable($startedAt))->format('U.u'); + $ended = empty($deployment->getAttribute('buildEndedAt')) + ? \microtime(true) + : (float) (new \DateTimeImmutable($deployment->getAttribute('buildEndedAt')))->format('U.u'); } catch (\Exception) { return 0; } // A timeout is a budget, not a measurement: termination grace can // legitimately leave the worker running past it. - return (int) \ceil(\max(0.0, \microtime(true) - $started)); + return (int) \ceil(\max(0.0, $ended - $started)); } /**