diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-17 15:37:40 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-17 15:37:40 +0200 |
commit | 031094f7992366d8d1f6583b205f984ffadf637a (patch) | |
tree | 34ee5dc91b3e540f6f0499beadbd74575d9ad434 /server/lib/jobs/handlers/video-file-optimizer.ts | |
parent | a6218a0b8f685078e6f7d21e9110b6418c5594fe (diff) | |
download | PeerTube-031094f7992366d8d1f6583b205f984ffadf637a.tar.gz PeerTube-031094f7992366d8d1f6583b205f984ffadf637a.tar.zst PeerTube-031094f7992366d8d1f6583b205f984ffadf637a.zip |
More robust transcoding jobs
Diffstat (limited to 'server/lib/jobs/handlers/video-file-optimizer.ts')
-rw-r--r-- | server/lib/jobs/handlers/video-file-optimizer.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/lib/jobs/handlers/video-file-optimizer.ts b/server/lib/jobs/handlers/video-file-optimizer.ts index a87ce52dc..63a51064c 100644 --- a/server/lib/jobs/handlers/video-file-optimizer.ts +++ b/server/lib/jobs/handlers/video-file-optimizer.ts | |||
@@ -6,8 +6,14 @@ import { VideoInstance } from '../../../models' | |||
6 | import { addVideoToFriends } from '../../friends' | 6 | import { addVideoToFriends } from '../../friends' |
7 | import { JobScheduler } from '../job-scheduler' | 7 | import { JobScheduler } from '../job-scheduler' |
8 | 8 | ||
9 | function process (data: { videoUUID: string }) { | 9 | function process (data: { videoUUID: string }, jobId: number) { |
10 | return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => { | 10 | return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => { |
11 | // No video, maybe deleted? | ||
12 | if (!video) { | ||
13 | logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid }) | ||
14 | return undefined | ||
15 | } | ||
16 | |||
11 | return video.optimizeOriginalVideofile().then(() => video) | 17 | return video.optimizeOriginalVideofile().then(() => video) |
12 | }) | 18 | }) |
13 | } | 19 | } |
@@ -18,6 +24,8 @@ function onError (err: Error, jobId: number) { | |||
18 | } | 24 | } |
19 | 25 | ||
20 | function onSuccess (jobId: number, video: VideoInstance) { | 26 | function onSuccess (jobId: number, video: VideoInstance) { |
27 | if (video === undefined) return undefined | ||
28 | |||
21 | logger.info('Job %d is a success.', jobId) | 29 | logger.info('Job %d is a success.', jobId) |
22 | 30 | ||
23 | video.toAddRemoteJSON() | 31 | video.toAddRemoteJSON() |