Add Force clear for stuck queues including running YuE jobs.
Queue page and Music get a nuclear clear that cancels studio/live work, wipes shot batches, and force-stops Comfy so images/video/other music can run again. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,7 +8,7 @@ export default defineEventHandler(async (event) => {
|
||||
const comfy = await requestComfyForceReset()
|
||||
return {
|
||||
ok: true,
|
||||
message: 'Cleared stuck jobs and force-stopped Comfy. Use Wake / Poke when you want the GPU again.',
|
||||
message: 'Cleared every stuck Studio/music/shot job and force-stopped Comfy. Use Wake / Poke when you want the GPU again.',
|
||||
cleared,
|
||||
comfy
|
||||
}
|
||||
|
||||
@@ -484,6 +484,20 @@ export async function clearShotQueues(owner: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Nuclear clear: wipe every shot batch for this owner, including ones marked running. */
|
||||
export async function forceClearAllShotQueues(owner: string) {
|
||||
const before = listShotQueues(owner)
|
||||
for (const queue of before) {
|
||||
markShotQueueCancelled(queue.id)
|
||||
activeJobs.delete(queue.id)
|
||||
}
|
||||
return mutate(owner, (queues) => {
|
||||
const removed = queues.length
|
||||
queues.splice(0, queues.length)
|
||||
return { removed }
|
||||
})
|
||||
}
|
||||
|
||||
export function listOwnersWithQueues() {
|
||||
const root = join(libraryRoot(), 'users')
|
||||
if (!existsSync(root)) return []
|
||||
|
||||
@@ -483,7 +483,7 @@ export async function cancelStudioJob(owner: string, id: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
/** Wipe waiting/running/held studio rows + live/pending jobs for this owner (stuck recovery). */
|
||||
/** Wipe waiting/running/held studio rows + live/pending/shot queues for this owner (stuck recovery). */
|
||||
export async function clearStuckStudioWork(owner: string) {
|
||||
const liveIds = new Set<string>()
|
||||
const cancelledStudio: string[] = []
|
||||
@@ -530,10 +530,16 @@ export async function clearStuckStudioWork(owner: string) {
|
||||
|
||||
for (const id of liveIds) deletePendingJob(id)
|
||||
|
||||
const { forceClearAllShotQueues } = await import('~/server/utils/shotQueue')
|
||||
const shots = await forceClearAllShotQueues(owner).catch(() => ({ removed: 0 }))
|
||||
|
||||
kickStudioQueue()
|
||||
|
||||
return {
|
||||
cancelledStudio: cancelledStudio.length,
|
||||
clearedPending: clearedPending.length,
|
||||
cancelledLive: liveIds.size
|
||||
cancelledLive: liveIds.size,
|
||||
clearedShotQueues: Number(shots?.removed || 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user