Don't create pendingTranscription twice

This commit is contained in:
Chocobozzz 2024-07-03 08:32:14 +02:00
parent 91302ea12a
commit 2d26eff129
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,7 @@ describe('Test runner transcription', function () {
async function upload () {
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video', language: undefined } })
await waitJobs(servers)
const { availableJobs } = await servers[0].runnerJobs.request({ runnerToken })
expect(availableJobs).to.have.lengthOf(1)
@ -103,6 +104,23 @@ describe('Test runner transcription', function () {
}
})
it('Should error a transcription job and decrease the job count', async function () {
this.timeout(60000)
const { job, uuid } = await upload()
await servers[0].runnerJobs.error({ runnerToken, jobUUID: job.uuid, jobToken: job.jobToken, message: 'Error' })
for (let i = 0; i < 4; i++) {
const { job: { jobToken } } = await servers[0].runnerJobs.accept({ runnerToken, jobUUID: job.uuid })
await servers[0].runnerJobs.error({ runnerToken, jobUUID: job.uuid, jobToken, message: 'Error' })
}
await waitJobs(servers)
await servers[0].captions.runGenerate({ videoId: uuid })
})
after(async function () {
await cleanupTests(servers)
})

View File

@ -75,8 +75,6 @@ export class TranscriptionJobHandler extends AbstractJobHandler<CreateOptions, R
priority: JOB_PRIORITY.TRANSCODING
})
await VideoJobInfoModel.increaseOrCreate(video.uuid, 'pendingTranscription')
return job
}

View File

@ -139,7 +139,7 @@ export async function onTranscriptionEnded (options: {
const { video, language, vttPath, lTags: customLTags = [] } = options
if (!isVideoCaptionLanguageValid(language)) {
logger.warn(`Invalid transcription language for video ${video.uuid}`, this.lTags(video.uuid))
logger.warn(`Invalid transcription language for video ${video.uuid}`, lTags(video.uuid))
return
}