fix: stop legacy duration at the recorded build end

This commit is contained in:
loks0n committed 2026-09-14 12:28:04 +01:00
1 parent c18642eca5
commit 6e53246929
1 file changed
+4 -1
@@ -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));
}
/**