diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2021-11-08 04:20:04 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-11-09 15:00:21 +0100 |
commit | 4e29f4fe23b413cc8c55ac0d8373f36bcd60b47a (patch) | |
tree | c9e63dac52672d46cbf0072dc35e396dca61079c /server/lib/job-queue/handlers/video-transcoding.ts | |
parent | 9c391612038cd48cfeb2315dcbb8feddcf877d94 (diff) | |
download | PeerTube-4e29f4fe23b413cc8c55ac0d8373f36bcd60b47a.tar.gz PeerTube-4e29f4fe23b413cc8c55ac0d8373f36bcd60b47a.tar.zst PeerTube-4e29f4fe23b413cc8c55ac0d8373f36bcd60b47a.zip |
video: add video stranscoding_failed state
Diffstat (limited to 'server/lib/job-queue/handlers/video-transcoding.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-transcoding.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 20880cdc1..b280a1cc9 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts | |||
@@ -2,7 +2,7 @@ import { Job } from 'bull' | |||
2 | import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' | 2 | import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' |
3 | import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' | 3 | import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' |
4 | import { VideoPathManager } from '@server/lib/video-path-manager' | 4 | import { VideoPathManager } from '@server/lib/video-path-manager' |
5 | import { moveToNextState } from '@server/lib/video-state' | 5 | import { moveToFailedState, moveToNextState } from '@server/lib/video-state' |
6 | import { UserModel } from '@server/models/user/user' | 6 | import { UserModel } from '@server/models/user/user' |
7 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' | 7 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' |
8 | import { MUser, MUserId, MVideo, MVideoFullLight, MVideoWithFile } from '@server/types/models' | 8 | import { MUser, MUserId, MVideo, MVideoFullLight, MVideoWithFile } from '@server/types/models' |
@@ -52,10 +52,17 @@ async function processVideoTranscoding (job: Job) { | |||
52 | const handler = handlers[payload.type] | 52 | const handler = handlers[payload.type] |
53 | 53 | ||
54 | if (!handler) { | 54 | if (!handler) { |
55 | await moveToFailedState(video) | ||
55 | throw new Error('Cannot find transcoding handler for ' + payload.type) | 56 | throw new Error('Cannot find transcoding handler for ' + payload.type) |
56 | } | 57 | } |
57 | 58 | ||
58 | await handler(job, payload, video, user) | 59 | try { |
60 | await handler(job, payload, video, user) | ||
61 | } catch (error) { | ||
62 | await moveToFailedState(video) | ||
63 | |||
64 | throw error | ||
65 | } | ||
59 | 66 | ||
60 | return video | 67 | return video |
61 | } | 68 | } |