Restore automatic video batch continuation and prepare stable Comfy loading
This commit is contained in:
@@ -4,7 +4,7 @@ import { toggleStudioQueuePause } from '~/server/utils/studioQueue'
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const body = await readBody<{ resume?: boolean }>().catch(() => ({} as { resume?: boolean }))
|
||||
const body = await readBody<{ resume?: boolean }>(event).catch(() => ({} as { resume?: boolean }))
|
||||
const queue = getShotQueue(owner, id)
|
||||
if (!queue) throw createError({ statusCode: 404, statusMessage: 'Queue not found' })
|
||||
const result = await toggleStudioQueuePause(owner, {
|
||||
|
||||
@@ -445,6 +445,7 @@ export async function setShotQueuePause(owner: string, id: string, pause: boolea
|
||||
else if (queue.status !== 'complete') queue.status = 'paused'
|
||||
} else {
|
||||
queue.stopAfterCurrent = false
|
||||
if (pendingSegmentCount(queue) > 0) queue.autoRun = true
|
||||
if (live?.library) live.library.queueAutoRun = queue.autoRun === true
|
||||
if (queue.status === 'paused') queue.status = 'idle'
|
||||
}
|
||||
|
||||
@@ -1808,6 +1808,10 @@ export async function toggleStudioQueuePause(owner: string, options: {
|
||||
if (options.queueId && job.shotQueueId !== options.queueId) continue
|
||||
job.pauseAfterCurrent = false
|
||||
job.pausedByUser = false
|
||||
if (job.shotQueueId && job.status !== 'complete' && job.status !== 'cancelled') {
|
||||
job.resumeAutoRun = true
|
||||
job.payload.queueAutoRun = true
|
||||
}
|
||||
}
|
||||
syncPausedFlag(store)
|
||||
return structuredClone(store)
|
||||
@@ -1831,7 +1835,7 @@ export async function toggleStudioQueuePause(owner: string, options: {
|
||||
}
|
||||
const busy = await videoJobsBusy()
|
||||
if (heldPaused[0] && !busy) {
|
||||
await resumeHeldStudioJob(heldPaused[0]).catch(() => null)
|
||||
await resumeHeldStudioJob(rows.find(row => row.id === heldPaused[0].id) || heldPaused[0]).catch(() => null)
|
||||
} else {
|
||||
if (heldPaused.length && busy) {
|
||||
await mutate(owner, (jobs) => {
|
||||
@@ -1936,6 +1940,10 @@ export async function onStudioQueueBurstStarted(owner: string, queueId: string,
|
||||
if (queue?.autoRun === true) {
|
||||
row.resumeAutoRun = true
|
||||
row.payload.queueAutoRun = true
|
||||
} else if (queue) {
|
||||
// An explicit one-shot / next-three request must replace an earlier run-all policy.
|
||||
row.resumeAutoRun = false
|
||||
row.payload.queueAutoRun = false
|
||||
}
|
||||
row.updatedAt = Date.now()
|
||||
syncPausedFlag(store)
|
||||
|
||||
Reference in New Issue
Block a user