mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: correct stale progress file cleanup status detection
Steps are keyed by step name (e.g. 'env-vars'), not by status value. The old lookup used status constants as step keys, so $status was always null and terminal-state cleanup never triggered. Detect terminal state by checking for $data['error'] (failure) or all steps having 'completed' status. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6c76783c09
commit
9bc263ab22
@@ -234,14 +234,21 @@ class State
|
||||
@unlink($file);
|
||||
continue;
|
||||
}
|
||||
$status = $data['steps'][Server::STATUS_ERROR]['status']
|
||||
?? $data['steps'][Server::STATUS_COMPLETED]['status']
|
||||
?? null;
|
||||
$updatedAt = $data['updatedAt'] ?? 0;
|
||||
$age = time() - (int) $updatedAt;
|
||||
$isTerminal = isset($data['error']);
|
||||
if (!$isTerminal && !empty($data['steps'])) {
|
||||
$isTerminal = true;
|
||||
foreach ($data['steps'] as $step) {
|
||||
if (($step['status'] ?? '') !== Server::STATUS_COMPLETED) {
|
||||
$isTerminal = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($age > self::GLOBAL_LOCK_TIMEOUT_SECONDS) {
|
||||
@unlink($file);
|
||||
} elseif (in_array($status, [Server::STATUS_COMPLETED, Server::STATUS_ERROR], true) && $age > 60) {
|
||||
} elseif ($isTerminal && $age > 60) {
|
||||
@unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user