Reattach Comfy watchers after refresh so pending jobs finish and save.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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()]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user