diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-23 11:09:31 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-23 11:13:06 +0100 |
commit | dbd9fb44ddd880622265097bd7baf4dd71ea0861 (patch) | |
tree | b531f861026a52bcacfdee076431c1c34d9ba78d /server/lib/video-state.ts | |
parent | 482b26231b4e39234f107b8400ef606c5f003c55 (diff) | |
download | PeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.tar.gz PeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.tar.zst PeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.zip |
Don't stuck state when move transcoding job failed
Diffstat (limited to 'server/lib/video-state.ts')
-rw-r--r-- | server/lib/video-state.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/lib/video-state.ts b/server/lib/video-state.ts index e420991cd..97ff540ed 100644 --- a/server/lib/video-state.ts +++ b/server/lib/video-state.ts | |||
@@ -4,7 +4,7 @@ import { CONFIG } from '@server/initializers/config' | |||
4 | import { sequelizeTypescript } from '@server/initializers/database' | 4 | import { sequelizeTypescript } from '@server/initializers/database' |
5 | import { VideoModel } from '@server/models/video/video' | 5 | import { VideoModel } from '@server/models/video/video' |
6 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' | 6 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' |
7 | import { MVideoFullLight, MVideoUUID } from '@server/types/models' | 7 | import { MVideo, MVideoFullLight, MVideoUUID } from '@server/types/models' |
8 | import { VideoState } from '@shared/models' | 8 | import { VideoState } from '@shared/models' |
9 | import { federateVideoIfNeeded } from './activitypub/videos' | 9 | import { federateVideoIfNeeded } from './activitypub/videos' |
10 | import { Notifier } from './notifier' | 10 | import { Notifier } from './notifier' |
@@ -79,18 +79,25 @@ async function moveToExternalStorageState (video: MVideoFullLight, isNewVideo: b | |||
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | function moveToFailedTranscodingState (video: MVideoFullLight) { | 82 | function moveToFailedTranscodingState (video: MVideo) { |
83 | if (video.state === VideoState.TRANSCODING_FAILED) return | 83 | if (video.state === VideoState.TRANSCODING_FAILED) return |
84 | 84 | ||
85 | return video.setNewState(VideoState.TRANSCODING_FAILED, false, undefined) | 85 | return video.setNewState(VideoState.TRANSCODING_FAILED, false, undefined) |
86 | } | 86 | } |
87 | 87 | ||
88 | function moveToFailedMoveToObjectStorageState (video: MVideo) { | ||
89 | if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED) return | ||
90 | |||
91 | return video.setNewState(VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED, false, undefined) | ||
92 | } | ||
93 | |||
88 | // --------------------------------------------------------------------------- | 94 | // --------------------------------------------------------------------------- |
89 | 95 | ||
90 | export { | 96 | export { |
91 | buildNextVideoState, | 97 | buildNextVideoState, |
92 | moveToExternalStorageState, | 98 | moveToExternalStorageState, |
93 | moveToFailedTranscodingState, | 99 | moveToFailedTranscodingState, |
100 | moveToFailedMoveToObjectStorageState, | ||
94 | moveToNextState | 101 | moveToNextState |
95 | } | 102 | } |
96 | 103 | ||