Kick the studio dispatcher when the UI polls a stalled waiting queue.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { listShotQueues, summarizeQueue } from '~/server/utils/shotQueue'
|
||||
import { listStudioJobs, summarizeStudioJob } from '~/server/utils/studioQueue'
|
||||
import { kickStudioQueue, listStudioJobs, summarizeStudioJob } from '~/server/utils/studioQueue'
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
@@ -54,10 +54,15 @@ export default defineEventHandler((event) => {
|
||||
.filter(queue => !claimed.has(queue.id) && queue.status !== 'complete')
|
||||
.map(summarizeQueue)
|
||||
: []
|
||||
const waitingCount = jobs.filter(job => job.status === 'waiting').length
|
||||
// Nudge the dispatcher whenever the UI polls a stalled waiting queue.
|
||||
if (waitingCount > 0 && !jobs.some(job => job.status === 'running')) {
|
||||
void kickStudioQueue()
|
||||
}
|
||||
return {
|
||||
jobs,
|
||||
orphans,
|
||||
waitingCount: jobs.filter(job => job.status === 'waiting').length,
|
||||
waitingCount,
|
||||
paused: jobs.some(job => job.pausedByUser === true)
|
||||
|| orphans.some(queue => queue.stopAfterCurrent === true && queue.status !== 'running'),
|
||||
willPause: jobs.some(job => (
|
||||
|
||||
Reference in New Issue
Block a user