From 025d858e7997d6b9895fa6b7beaf23bf5ff814af Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 3 Dec 2021 14:40:29 +0100 Subject: Fix pending transcoding with failed job --- server/models/video/video-job-info.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/models/video') diff --git a/server/models/video/video-job-info.ts b/server/models/video/video-job-info.ts index cb1f3f2f0..7da5128d7 100644 --- a/server/models/video/video-job-info.ts +++ b/server/models/video/video-job-info.ts @@ -3,6 +3,8 @@ import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, IsInt, Mo import { AttributesOnly } from '@shared/core-utils' import { VideoModel } from './video' +export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode' + @Table({ tableName: 'videoJobInfo', indexes: [ @@ -57,7 +59,7 @@ export class VideoJobInfoModel extends Model { + static async increaseOrCreate (videoUUID: string, column: VideoJobInfoColumnType): Promise { const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` @@ -79,7 +81,7 @@ export class VideoJobInfoModel extends Model { + static async decrease (videoUUID: string, column: VideoJobInfoColumnType): Promise { const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` -- cgit v1.2.3