Reattach Comfy watchers after refresh so pending jobs finish and save.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-27 08:09:20 -05:00
co-authored by Cursor
parent 159c84be75
commit 1466762af4
8 changed files with 137 additions and 30 deletions
+30
View File
@@ -118,6 +118,36 @@ export function getJob(id: string) {
return jobs.get(id)
}
export function restoreJob(params: {
id: string
clientId: string
promptId: string
startedAt: number
hideThumbnail?: boolean
library: Job['library']
}) {
const existing = jobs.get(params.id)
if (existing) return existing
const job: Job = {
id: params.id,
clientId: params.clientId,
kind: 'video',
promptId: params.promptId,
status: 'running',
message: 'Waiting for ComfyUI to finish this job...',
progress: 8,
step: 0,
maxStep: params.library?.steps || 0,
startedAt: params.startedAt,
hideThumbnail: params.hideThumbnail === true,
library: params.library,
events: [],
listeners: new Set()
}
jobs.set(job.id, job)
return job
}
export function listJobs() {
return [...jobs.values()]
}