fix(web-probe): reduce sentinel wait polling latency

This commit is contained in:
Codex
2026-06-26 14:40:53 +00:00
parent b1212f2d6d
commit b40712428f
+4 -4
View File
@@ -814,10 +814,10 @@ function collectSentinelObservedStatus(state: SentinelCicdState, timeoutSeconds:
function waitForSentinelObservedStatus(state: SentinelCicdState, timeoutSeconds: number, expectation?: SentinelObservedExpectation): SentinelObservedStatus {
const startedAt = Date.now();
const timeoutMs = Math.max(5_000, Math.min(timeoutSeconds * 1000, controlPlaneWaitWarningSeconds(state) * 1000));
const timeoutMs = Math.max(1_000, Math.min(timeoutSeconds * 1000, controlPlaneWaitWarningSeconds(state) * 1000));
let observed = collectSentinelObservedStatus(state, timeoutSeconds, expectation);
while (!sentinelObservedReady(observed) && Date.now() - startedAt < timeoutMs) {
runCommand(["sleep", "5"], repoRoot, { timeoutMs: 6_000 });
runCommand(["sleep", "2"], repoRoot, { timeoutMs: 3_000 });
observed = collectSentinelObservedStatus(state, timeoutSeconds, expectation);
}
return observed;
@@ -1011,7 +1011,7 @@ function runSentinelSourceMirrorSyncJob(state: SentinelCicdState, timeoutSeconds
slowWarningSent = true;
sentinelProgressEvent("sentinel.source-mirror.warning", { warning: `source mirror sync exceeded configured ${Math.round(warningBudgetMs / 1000)}s timing budget; non-blocking timing alert`, jobName, elapsedMs: Date.now() - startedAt, node: state.spec.nodeId, lane: state.spec.lane });
}
runCommand(["sleep", "5"], repoRoot, { timeoutMs: 6_000 });
runCommand(["sleep", "2"], repoRoot, { timeoutMs: 3_000 });
}
return { ok: false, phase: "job-timeout", jobName, payload: { ok: false, status: "timeout", valuesRedacted: true }, polls, elapsedMs: Date.now() - startedAt, probe: lastProbe, valuesRedacted: true };
}
@@ -1255,7 +1255,7 @@ function runSentinelPublishJob(state: SentinelCicdState, publishGitops: boolean,
slowWarningSent = true;
sentinelProgressEvent("sentinel.publish.warning", { warning: `remote publish job exceeded configured ${Math.round(warningBudgetMs / 1000)}s timing budget; non-blocking timing alert`, jobName, elapsedMs: Date.now() - startedAt, node: state.spec.nodeId, lane: state.spec.lane });
}
runCommand(["sleep", "5"], repoRoot, { timeoutMs: 6_000 });
runCommand(["sleep", "2"], repoRoot, { timeoutMs: 3_000 });
}
return { ok: false, phase: "job-timeout", jobName, payload: { ok: false, status: "timeout", valuesRedacted: true }, polls, elapsedMs: Date.now() - startedAt, probe: lastProbe, valuesRedacted: true };
}