Stop idle Comfy after 30 minutes and add a Wake GPU poke.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { requestComfyWake } from '~/server/utils/comfyLifecycle'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
return await requestComfyWake()
|
||||
})
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user