Queue more video jobs while a long shot list is generating, and restore that job from Output.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
import { listPendingJobs } from '~/server/utils/pending'
|
||||
import { listOwnersWithQueues, listShotQueues, pendingSegmentCount } from '~/server/utils/shotQueue'
|
||||
import { kickStudioQueue, listOwnersWithStudioQueues, listStudioJobs } from '~/server/utils/studioQueue'
|
||||
import { startQueueBurst } from '~/server/utils/videoChain'
|
||||
|
||||
export default defineNitroPlugin(() => {
|
||||
const pendingQueueIds = new Set(listPendingJobs().map(job => job.queueId).filter(Boolean))
|
||||
const claimedQueueIds = new Set<string>()
|
||||
for (const owner of listOwnersWithStudioQueues()) {
|
||||
for (const job of listStudioJobs(owner)) {
|
||||
if (!job.shotQueueId) continue
|
||||
if (job.status === 'waiting' || job.status === 'running' || job.status === 'held') {
|
||||
claimedQueueIds.add(job.shotQueueId)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const owner of listOwnersWithQueues()) {
|
||||
for (const queue of listShotQueues(owner)) {
|
||||
if (claimedQueueIds.has(queue.id)) continue
|
||||
if (!queue.autoRun) continue
|
||||
if (queue.status === 'complete') continue
|
||||
if (pendingQueueIds.has(queue.id)) continue
|
||||
@@ -13,4 +24,5 @@ export default defineNitroPlugin(() => {
|
||||
void startQueueBurst(owner, queue.id, 'all').catch(() => null)
|
||||
}
|
||||
}
|
||||
void kickStudioQueue()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user