Retry GPU wake when the LAN proxy is stale after idle-stop.
Idle-stop was leaving /status claiming Comfy was healthy, so the studio skipped start and failed on a dead 8198 instead of waking the GPU. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -470,6 +470,8 @@ async function maybeIdleStop(healthyPort) {
|
|||||||
const killed = await stopComfyProcesses()
|
const killed = await stopComfyProcesses()
|
||||||
stoppedByAgent = true
|
stoppedByAgent = true
|
||||||
lastQueueRunning = 0
|
lastQueueRunning = 0
|
||||||
|
lastHealthyPort = 0
|
||||||
|
lastProcessUp = false
|
||||||
console.log(JSON.stringify({ src: 'comfy-host-agent', event: 'stopped', reason: 'idle', killed }))
|
console.log(JSON.stringify({ src: 'comfy-host-agent', event: 'stopped', reason: 'idle', killed }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,6 +616,7 @@ const server = http.createServer(async (req, res) => {
|
|||||||
return json(res, 200, { ok: true, started: false, already: true, booting: true, asleep: false })
|
return json(res, 200, { ok: true, started: false, already: true, booting: true, asleep: false })
|
||||||
}
|
}
|
||||||
await taskkillImage('Comfy Desktop.exe')
|
await taskkillImage('Comfy Desktop.exe')
|
||||||
|
stoppedByAgent = false
|
||||||
const launched = await startComfy()
|
const launched = await startComfy()
|
||||||
if (launched.port) {
|
if (launched.port) {
|
||||||
lastProcessUp = true
|
lastProcessUp = true
|
||||||
|
|||||||
@@ -350,13 +350,7 @@ async function ensureUnlocked(onStatus: StatusFn, skipBusyWait = false) {
|
|||||||
onStatus({ state: 'online', message: 'ComfyUI online', host: proxyUrl, processRunning: true })
|
onStatus({ state: 'online', message: 'ComfyUI online', host: proxyUrl, processRunning: true })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
log('http-fail-proxy', { host: proxyUrl, localPort: remote.port || null })
|
||||||
if (remote?.http) {
|
|
||||||
const localPort = remote.port ? ` Port ${remote.port} is healthy on the desktop.` : ''
|
|
||||||
throw createError({
|
|
||||||
statusCode: 503,
|
|
||||||
statusMessage: `Comfy is running on the desktop but this server cannot reach ${host}.${localPort} Check COMFY_HOST / the LAN proxy.`
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
const running = await processRunning()
|
const running = await processRunning()
|
||||||
if (running) {
|
if (running) {
|
||||||
|
|||||||
Reference in New Issue
Block a user