Relaunch ComfyUI when a process is up but the API never becomes ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-25 19:40:52 -05:00
co-authored by Cursor
parent f5829995c8
commit 1a271c05a4
2 changed files with 18 additions and 15 deletions
+18 -14
View File
@@ -223,23 +223,27 @@ async function ensureUnlocked(onStatus: StatusFn) {
processRunning: true
})
const ready = await pollUntilHealthy(cfg.bootPollAttempts, cfg.bootPollDelayMs, onStatus, 'booting', 'Waiting for ComfyUI to finish booting')
if (!ready) {
throw createError({
statusCode: 503,
statusMessage: 'ComfyUI is running but port 8188 never became ready. Check the desktop instance.'
})
if (ready) {
await waitWhileBusy(onStatus)
onStatus({ state: 'online', message: 'ComfyUI online', host, processRunning: true })
return
}
await waitWhileBusy(onStatus)
onStatus({ state: 'online', message: 'ComfyUI online', host, processRunning: true })
return
onStatus({
state: 'starting',
message: 'ComfyUI is running but the API never came up. Attempting a relaunch...',
host,
processRunning: true
})
}
onStatus({
state: 'starting',
message: 'ComfyUI is offline. Starting the desktop instance...',
host,
processRunning: false
})
if (!running) {
onStatus({
state: 'starting',
message: 'ComfyUI is offline. Starting the desktop instance...',
host,
processRunning: false
})
}
const started = await startComfy()
if (!started.started) {
throw createError({