]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/transcoding/ended-transcoding.ts
Support studio transcoding in peertube runner
[github/Chocobozzz/PeerTube.git] / server / lib / transcoding / ended-transcoding.ts
CommitLineData
0c9668f7
C
1import { retryTransactionWrapper } from '@server/helpers/database-utils'
2import { VideoJobInfoModel } from '@server/models/video/video-job-info'
3import { MVideo } from '@server/types/models'
4import { moveToNextState } from '../video-state'
5
6export async function onTranscodingEnded (options: {
7 video: MVideo
8 isNewVideo: boolean
9 moveVideoToNextState: boolean
10}) {
11 const { video, isNewVideo, moveVideoToNextState } = options
12
13 await VideoJobInfoModel.decrease(video.uuid, 'pendingTranscode')
14
15 if (moveVideoToNextState) {
16 await retryTransactionWrapper(moveToNextState, { video, isNewVideo })
17 }
18}