diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 14:22:37 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 14:22:37 +0200 |
commit | 4077df72c634ff17aaf69cc612fc6bb8d68b1ed8 (patch) | |
tree | 03fdc7d773c447cd883f8b277945e5610bf70a34 /server/lib/jobs/handlers/video-file-transcoder.ts | |
parent | 911238e343e1cccae349ff9c44bcffadb96fa393 (diff) | |
download | PeerTube-4077df72c634ff17aaf69cc612fc6bb8d68b1ed8.tar.gz PeerTube-4077df72c634ff17aaf69cc612fc6bb8d68b1ed8.tar.zst PeerTube-4077df72c634ff17aaf69cc612fc6bb8d68b1ed8.zip |
Fix integrity with transcoding jobs
Diffstat (limited to 'server/lib/jobs/handlers/video-file-transcoder.ts')
-rw-r--r-- | server/lib/jobs/handlers/video-file-transcoder.ts | 13 |
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 | ||
25 | function onSuccess (jobId: number, video: VideoInstance) { | 25 | async 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 | // --------------------------------------------------------------------------- |