mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 08:44:06 +00:00
fix: jobs stuck in initializing state when failing before execution_start (#8689)
## Summary Fix jobs getting permanently stuck in "initializing" state when they fail before the `execution_start` WebSocket event fires. ## Changes - **What**: Added `reconcileInitializingPrompts(activeJobIds)` to `executionStore` that removes orphaned initializing prompt IDs not present in the active jobs set. Called from `queueStore.update()` after fetching Running/Pending jobs, ensuring stale initializing states are cleaned up on every queue poll. ## Review Focus - The reconciliation delegates to the existing `clearInitializationByPromptIds` to avoid duplicating Set-diffing logic. - Only runs during `queueStore.update()` which is already a periodic poll — no additional network calls. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8689-fix-jobs-stuck-in-initializing-state-when-failing-before-execution_start-2ff6d73d3650814dbeeeda71c8bb7d43) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -537,6 +537,18 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
// Only reconcile when the queue fetch returned data. api.getQueue()
|
||||
// returns empty Running/Pending on transient errors, which would
|
||||
// incorrectly clear all initializing prompts.
|
||||
const queueHasData = queue.Running.length > 0 || queue.Pending.length > 0
|
||||
if (queueHasData) {
|
||||
const activeJobIds = new Set([
|
||||
...queue.Running.map((j) => j.id),
|
||||
...queue.Pending.map((j) => j.id)
|
||||
])
|
||||
executionStore.reconcileInitializingPrompts(activeJobIds)
|
||||
}
|
||||
|
||||
// Sort by create_time descending and limit to maxItems
|
||||
const sortedHistory = [...history]
|
||||
.sort((a, b) => b.create_time - a.create_time)
|
||||
|
||||
Reference in New Issue
Block a user