Clarify provisioning wait messages (fixes #54)

This commit is contained in:
2026-09-28 10:21:52 -04:00
parent 3c0c54e804
commit 5b65520bbc
5 changed files with 14 additions and 12 deletions
+4 -4
View File
@@ -57,7 +57,7 @@ function sourceEligibility(operation: Operation): 'ready' | 'held' | 'cancelled'
return held ? 'held' : ready ? 'ready' : 'cancelled';
}
function blocker(server: string, id: string): string | null {
function blocker(server: string, id: string, action: RuntimeAction): string | null {
const sources = sourcesFor(id);
const rank = priority(sources);
const others = db().prepare(`SELECT id, state, action, rowid FROM server_deployments WHERE server = ? AND id != ? AND server_deleted_at IS NULL
@@ -76,7 +76,7 @@ function blocker(server: string, id: string): string | null {
SELECT 1 FROM server_deployments d WHERE d.id = ds.provisioning_id AND d.state IN ('queued','waiting','running','awaiting-health')))
AND NOT EXISTS (SELECT 1 FROM watchdog_actions a WHERE a.operation_id = ? AND a.campaign_id = ds.deployment_id)
LIMIT 1`).get(server, id)) return 'Waiting for campaign work on this server';
return rolloutWaitReason(server, id);
return rolloutWaitReason(server, id, action);
}
interface Operation { id: string; server: string; action: RuntimeAction; state: string; stage: string }
@@ -128,7 +128,7 @@ async function processOperation(operation: Operation): Promise<void> {
} else deploymentStage(id, 'Waiting for container to stop' + (!health.ok ? ': ' + health.reason : ''));
return;
}
const reason = blocker(server, id);
const reason = blocker(server, id, action);
if (reason) { deploymentStage(id, reason); return; }
const health = await komodoInspectHealthy(server);
if (action !== 'start' && !isStopped(health.state)) {
@@ -140,7 +140,7 @@ async function processOperation(operation: Operation): Promise<void> {
}
}
// Requests can arrive during the probes. Recheck before claiming the action.
const latestReason = blocker(server, id);
const latestReason = blocker(server, id, action);
if (latestReason) { deploymentStage(id, latestReason); return; }
if (sourceEligibility(operation) !== 'ready') return;
if (!db().prepare("SELECT 1 FROM server_deployments WHERE id = ? AND server_deleted_at IS NULL AND state = 'waiting'").get(id)) return;