ended-transcoding.ts 628 B

123456789101112131415161718
  1. import { retryTransactionWrapper } from '@server/helpers/database-utils.js'
  2. import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'
  3. import { MVideo } from '@server/types/models/index.js'
  4. import { moveToNextState } from '../video-state.js'
  5. export async function onTranscodingEnded (options: {
  6. video: MVideo
  7. isNewVideo: boolean
  8. moveVideoToNextState: boolean
  9. }) {
  10. const { video, isNewVideo, moveVideoToNextState } = options
  11. await VideoJobInfoModel.decrease(video.uuid, 'pendingTranscode')
  12. if (moveVideoToNextState) {
  13. await retryTransactionWrapper(moveToNextState, { video, isNewVideo })
  14. }
  15. }