Do not mark Beast offline when /system_stats times out during a render.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-12
@@ -13,21 +13,23 @@ export default defineEventHandler(async () => {
|
||||
videoConfigured
|
||||
? checkComfyHttp().catch(() => ({ ok: false, host: '', stats: null }))
|
||||
: Promise.resolve({ ok: false, host: '', stats: null }),
|
||||
videoConfigured ? fetchQueue() : Promise.resolve({ running: 0, pending: 0 }),
|
||||
videoConfigured ? fetchQueue() : Promise.resolve({ running: 0, pending: 0, ok: false }),
|
||||
beastHost
|
||||
? checkImageComfyHttp(2500, beastHost).catch(() => ({ ok: false, host: beastHost, stats: null }))
|
||||
? checkImageComfyHttp(5000, beastHost).catch(() => ({ ok: false, host: beastHost, stats: null }))
|
||||
: Promise.resolve({ ok: false, host: beastHost, stats: null }),
|
||||
beastHost ? fetchQueueAt(beastHost) : Promise.resolve({ running: 0, pending: 0 }),
|
||||
beastHost ? fetchQueueAt(beastHost) : Promise.resolve({ running: 0, pending: 0, ok: false }),
|
||||
promptHost && !promptIsBeast
|
||||
? checkImageComfyHttp(2500, promptHost).catch(() => ({ ok: false, host: promptHost, stats: null }))
|
||||
? 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 })
|
||||
promptHost && !promptIsBeast ? fetchQueueAt(promptHost) : Promise.resolve({ running: 0, pending: 0, ok: false })
|
||||
])
|
||||
const busy = Boolean(comfy.ok && queue.running > 0)
|
||||
const beastBusy = Boolean(beast.ok && beastQueue.running > 0)
|
||||
const promptOk = promptIsBeast ? Boolean(beast.ok || comfy.ok) : Boolean(prompt.ok)
|
||||
const promptBusy = promptIsBeast ? (beastBusy || busy) : Boolean(prompt.ok && promptQueue.running > 0)
|
||||
const imageOk = Boolean(beast.ok || comfy.ok)
|
||||
const comfyReachable = Boolean(comfy.ok || queue.ok)
|
||||
const beastReachable = Boolean(beast.ok || beastQueue.ok || comfyReachable)
|
||||
const busy = Boolean(comfyReachable && queue.running > 0)
|
||||
const beastBusy = Boolean(beastReachable && beastQueue.running > 0)
|
||||
const promptOk = promptIsBeast ? beastReachable : Boolean(prompt.ok || promptQueue.ok)
|
||||
const promptBusy = promptIsBeast ? (beastBusy || busy) : Boolean(promptOk && promptQueue.running > 0)
|
||||
const imageOk = Boolean(beastReachable || comfyReachable)
|
||||
const imageBusy = Boolean(imageConfigured && (beastBusy || busy))
|
||||
const preferredHost = beastHost || comfy.host || ''
|
||||
const promptQueueRunning = promptIsBeast ? ((beastQueue.running || queue.running) || 0) : (promptQueue.running || 0)
|
||||
@@ -36,7 +38,7 @@ export default defineEventHandler(async () => {
|
||||
ok: true,
|
||||
service: useRuntimeConfig().public.instanceName || 'aigen',
|
||||
comfy: {
|
||||
ok: comfy.ok,
|
||||
ok: comfyReachable,
|
||||
busy,
|
||||
host: comfy.host || '',
|
||||
queueRunning: queue.running,
|
||||
@@ -54,7 +56,7 @@ export default defineEventHandler(async () => {
|
||||
beast: {
|
||||
label: 'Beast',
|
||||
configured: Boolean(beastHost),
|
||||
ok: Boolean(beast.ok || comfy.ok),
|
||||
ok: beastReachable,
|
||||
busy: beastBusy || busy,
|
||||
host: preferredHost
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { listShotQueues, summarizeQueue } from '~/server/utils/shotQueue'
|
||||
import { kickStudioQueue, listStudioJobs, summarizeStudioJob } from '~/server/utils/studioQueue'
|
||||
import { listStudioJobs, summarizeStudioJob } from '~/server/utils/studioQueue'
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
@@ -51,7 +51,6 @@ export default defineEventHandler((event) => {
|
||||
.filter(queue => !claimed.has(queue.id) && queue.status !== 'complete')
|
||||
.map(summarizeQueue)
|
||||
: []
|
||||
if (jobs.some(job => job.status === 'waiting')) void kickStudioQueue()
|
||||
return {
|
||||
jobs,
|
||||
orphans,
|
||||
|
||||
Reference in New Issue
Block a user