Improve music activity reporting and preserve Comfy host fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createJob, emitJob, type Job } from '~/server/utils/jobs'
|
||||
import { extractAudio, fetchHistory, fetchHistoryAll, findHistoryAudio, freeComfyVram, purgeComfyArtifacts, queuePrompt } from '~/server/utils/comfy'
|
||||
import { comfyWsUrl } from '~/server/utils/comfy'
|
||||
import { comfyWsUrl, comfyFetch } from '~/server/utils/comfy'
|
||||
import { ensureComfyReady } from '~/server/utils/comfyLifecycle'
|
||||
import { downloadComfyAudio, saveTrack } from '~/server/utils/library'
|
||||
import { buildMusicWorkflow, musicFilenamePrefix, assertMusicEngineNodes } from '~/server/utils/musicWorkflow'
|
||||
@@ -231,6 +231,19 @@ function watchMusicJob(job: Job): Promise<void> {
|
||||
}
|
||||
|
||||
const pollHistory = async () => {
|
||||
if (settled || finishing) return
|
||||
if (job.promptId) {
|
||||
try {
|
||||
const response = await comfyFetch('/queue', { signal: AbortSignal.timeout(2500) })
|
||||
if (response.ok) {
|
||||
const queue = await response.json() as { queue_running?: unknown[][] }
|
||||
job.musicActivity = {
|
||||
checkedAt: Date.now(),
|
||||
running: Boolean(queue.queue_running?.some(row => row[1] === job.promptId))
|
||||
}
|
||||
}
|
||||
} catch { /* Keep the last confirmation timestamp so the UI can show stale checks. */ }
|
||||
}
|
||||
if (settled || finishing) return
|
||||
try {
|
||||
const history = await fetchHistoryAll()
|
||||
|
||||
Reference in New Issue
Block a user