mirror of https://github.com/Chocobozzz/PeerTube
				
				
				
			Don't create pendingTranscription twice
							parent
							
								
									91302ea12a
								
							
						
					
					
						commit
						2d26eff129
					
				|  | @ -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) | ||||
|   }) | ||||
|  |  | |||
|  | @ -75,8 +75,6 @@ export class TranscriptionJobHandler extends AbstractJobHandler<CreateOptions, R | |||
|       priority: JOB_PRIORITY.TRANSCODING | ||||
|     }) | ||||
| 
 | ||||
|     await VideoJobInfoModel.increaseOrCreate(video.uuid, 'pendingTranscription') | ||||
| 
 | ||||
|     return job | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Chocobozzz
						Chocobozzz