Stop idle Comfy after 30 minutes and add a Wake GPU poke.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-29 17:59:18 -05:00
co-authored by Cursor
parent cdc69d2bd6
commit ad1f4f905a
8 changed files with 283 additions and 26 deletions
+7 -3
View File
@@ -1,4 +1,4 @@
import { checkComfyHttp, fetchQueue } from '~/server/utils/comfyLifecycle'
import { checkComfyHttp, fetchQueue, fetchComfyControlStatus } from '~/server/utils/comfyLifecycle'
import { comfyConfigured } from '~/server/utils/comfy'
import { imageComfyConfigured, getBeastImageHost, getSidecarImageHost, sameImageHost } from '~/server/utils/imageComfy'
import { checkImageComfyHttp, fetchQueueAt } from '~/server/utils/imageComfyLifecycle'
@@ -9,7 +9,7 @@ export default defineEventHandler(async () => {
const beastHost = getBeastImageHost()
const promptHost = getSidecarImageHost()
const promptIsBeast = Boolean(promptHost && beastHost && sameImageHost(promptHost, beastHost))
const [comfy, queue, beast, beastQueue, prompt, promptQueue] = await Promise.all([
const [comfy, queue, beast, beastQueue, prompt, promptQueue, control] = await Promise.all([
videoConfigured
? checkComfyHttp().catch(() => ({ ok: false, host: '', stats: null }))
: Promise.resolve({ ok: false, host: '', stats: null }),
@@ -21,7 +21,8 @@ export default defineEventHandler(async () => {
promptHost && !promptIsBeast
? checkImageComfyHttp(5000, promptHost).catch(() => ({ ok: false, host: promptHost, stats: null }))
: Promise.resolve({ ok: false, host: promptHost, stats: null }),
promptHost && !promptIsBeast ? fetchQueueAt(promptHost) : Promise.resolve({ running: 0, pending: 0, ok: false })
promptHost && !promptIsBeast ? fetchQueueAt(promptHost) : Promise.resolve({ running: 0, pending: 0, ok: false }),
fetchComfyControlStatus().catch(() => null)
])
const comfyReachable = Boolean(comfy.ok || queue.ok)
const beastReachable = Boolean(beast.ok || beastQueue.ok || comfyReachable)
@@ -43,6 +44,9 @@ export default defineEventHandler(async () => {
host: comfy.host || '',
queueRunning: queue.running,
queuePending: queue.pending,
asleep: Boolean(control?.asleep) && !comfyReachable,
processUp: Boolean(control?.process ?? control?.processUp),
lastActivityAt: control?.lastActivityAt || null,
stats: comfy.ok ? comfy.stats : undefined
},
imageComfy: {