1
0
Fork 0
peertube/server/lib/transcoding/ended-transcoding.ts
Chocobozzz 0c9668f779 Implement remote runner jobs in server
Move ffmpeg functions to @shared
2023-05-09 08:57:34 +02:00

18 lines
610 B
TypeScript

import { retryTransactionWrapper } from '@server/helpers/database-utils'
import { VideoJobInfoModel } from '@server/models/video/video-job-info'
import { MVideo } from '@server/types/models'
import { moveToNextState } from '../video-state'
export async function onTranscodingEnded (options: {
video: MVideo
isNewVideo: boolean
moveVideoToNextState: boolean
}) {
const { video, isNewVideo, moveVideoToNextState } = options
await VideoJobInfoModel.decrease(video.uuid, 'pendingTranscode')
if (moveVideoToNextState) {
await retryTransactionWrapper(moveToNextState, { video, isNewVideo })
}
}