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.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/server/lib/jobs/handlers/video-file-transcoder.ts b/server/lib/jobs/handlers/video-file-transcoder.ts
index b240ff58a..a8d80ed45 100644
--- a/server/lib/jobs/handlers/video-file-transcoder.ts
+++ b/server/lib/jobs/handlers/video-file-transcoder.ts
@@ -22,15 +22,22 @@ function onError (err: Error, jobId: number) {
22 return Promise.resolve() 22 return Promise.resolve()
23} 23}
24 24
25function onSuccess (jobId: number, video: VideoInstance) { 25async function onSuccess (jobId: number, video: VideoInstance) {
26 if (video === undefined) return undefined 26 if (video === undefined) return undefined
27 27
28 logger.info('Job %d is a success.', jobId) 28 logger.info('Job %d is a success.', jobId)
29 29
30 const remoteVideo = video.toUpdateRemoteJSON() 30 // Maybe the video changed in database, refresh it
31 const videoDatabase = await db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(video.uuid)
32 // Video does not exist anymore
33 if (!videoDatabase) return undefined
34
35 const remoteVideo = videoDatabase.toUpdateRemoteJSON()
31 36
32 // Now we'll add the video's meta data to our friends 37 // Now we'll add the video's meta data to our friends
33 return updateVideoToFriends(remoteVideo, null) 38 await updateVideoToFriends(remoteVideo, null)
39
40 return
34} 41}
35 42
36// --------------------------------------------------------------------------- 43// ---------------------------------------------------------------------------