fix: harden desktop monitoring recovery
Desktop Client Build / Resolve Build Metadata (push) Successful in 37s
Backend CI / Backend (push) Failing after 9m26s
Desktop Client Build / Build Desktop Client (push) Successful in 22m29s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 35s

This commit is contained in:
2026-06-23 23:12:25 +08:00
parent b4ebf34728
commit 04bd3e42e0
16 changed files with 1329 additions and 164 deletions
@@ -64,6 +64,7 @@ interface MonitorSchedulerSelectionOptions {
maxConcurrency: number
activePlatforms: ReadonlySet<string>
activeQuestionKeys: ReadonlySet<string>
blockedPlatforms?: ReadonlySet<string>
activeCount: number
}
@@ -434,6 +435,22 @@ export function noteMonitorTaskLeaseMiss(taskId: string): void {
})
}
export function noteMonitorTaskDeferred(taskId: string, delayMs: number): void {
const now = Date.now()
const availableAt = now + Math.max(0, delayMs)
mutatePersistedState((draft) => {
const existing = draft.tasks[taskId]
if (!existing) {
return
}
existing.state = 'queued'
existing.availableAt = Math.max(existing.availableAt, availableAt)
existing.lastSeenAt = now
})
}
export function noteMonitorTaskCompleted(taskId: string): void {
const now = Date.now()
@@ -488,6 +505,10 @@ export function selectNextMonitorTask(
})
for (const candidate of candidates) {
if (options.blockedPlatforms?.has(candidate.platform)) {
continue
}
if (options.activePlatforms.has(candidate.platform)) {
continue
}