Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Don't create pendingTranscription twice

Chocobozzz2d26eff12939
diff --git a/packages/tests/src/api/runners/runner-transcription.ts b/packages/tests/src/api/runners/runner-transcription.ts
index cbd4b171fa..e041f88097 100644
--- a/packages/tests/src/api/runners/runner-transcription.ts
+++ b/packages/tests/src/api/runners/runner-transcription.ts
@@ -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)
})
diff --git a/server/core/lib/runners/job-handlers/transcription-job-handler.ts b/server/core/lib/runners/job-handlers/transcription-job-handler.ts
index 077f1afc24..2e830d75ce 100644
--- a/server/core/lib/runners/job-handlers/transcription-job-handler.ts
+++ b/server/core/lib/runners/job-handlers/transcription-job-handler.ts
@@ -75,8 +75,6 @@ export class TranscriptionJobHandler extends AbstractJobHandler<CreateOptions, R
priority: JOB_PRIORITY.TRANSCODING
})
- await VideoJobInfoModel.increaseOrCreate(video.uuid, 'pendingTranscription')
-
return job
}
diff --git a/server/core/lib/video-captions.ts b/server/core/lib/video-captions.ts
index 7037119f03..37948a5f00 100644
--- a/server/core/lib/video-captions.ts
+++ b/server/core/lib/video-captions.ts
@@ -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
}