aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/handlers/video-file-transcoder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/jobs/handlers/video-file-transcoder.ts')
-rw-r--r--server/lib/jobs/handlers/video-file-transcoder.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/lib/jobs/handlers/video-file-transcoder.ts b/server/lib/jobs/handlers/video-file-transcoder.ts
index 0e45b4dca..0dafee566 100644
--- a/server/lib/jobs/handlers/video-file-transcoder.ts
+++ b/server/lib/jobs/handlers/video-file-transcoder.ts
@@ -4,8 +4,14 @@ import { logger } from '../../../helpers'
4import { VideoInstance } from '../../../models' 4import { VideoInstance } from '../../../models'
5import { VideoResolution } from '../../../../shared' 5import { VideoResolution } from '../../../../shared'
6 6
7function process (data: { videoUUID: string, resolution: VideoResolution }) { 7function process (data: { videoUUID: string, resolution: VideoResolution }, jobId: number) {
8 return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => { 8 return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => {
9 // No video, maybe deleted?
10 if (!video) {
11 logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid })
12 return undefined
13 }
14
9 return video.transcodeOriginalVideofile(data.resolution).then(() => video) 15 return video.transcodeOriginalVideofile(data.resolution).then(() => video)
10 }) 16 })
11} 17}
@@ -16,6 +22,8 @@ function onError (err: Error, jobId: number) {
16} 22}
17 23
18function onSuccess (jobId: number, video: VideoInstance) { 24function onSuccess (jobId: number, video: VideoInstance) {
25 if (video === undefined) return undefined
26
19 logger.info('Job %d is a success.', jobId) 27 logger.info('Job %d is a success.', jobId)
20 28
21 const remoteVideo = video.toUpdateRemoteJSON() 29 const remoteVideo = video.toUpdateRemoteJSON()