aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/lib/transcoding/ended-transcoding.ts
blob: d31674ede838143b88a50667abdc057d3a214bd0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                         
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 })
  }
}