aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-03 14:40:29 +0100
committerChocobozzz <me@florianbigard.com>2021-12-03 14:40:29 +0100
commit025d858e7997d6b9895fa6b7beaf23bf5ff814af (patch)
treeaaf56b415d1e31f681a14a67a235b5af3a960ef1 /server/models
parent453537426a4e172967320cfac4bb1f53c28d94f5 (diff)
downloadPeerTube-025d858e7997d6b9895fa6b7beaf23bf5ff814af.tar.gz
PeerTube-025d858e7997d6b9895fa6b7beaf23bf5ff814af.tar.zst
PeerTube-025d858e7997d6b9895fa6b7beaf23bf5ff814af.zip
Fix pending transcoding with failed job
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-job-info.ts6
1 files changed, 4 insertions, 2 deletions
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
3import { AttributesOnly } from '@shared/core-utils' 3import { AttributesOnly } from '@shared/core-utils'
4import { VideoModel } from './video' 4import { VideoModel } from './video'
5 5
6export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode'
7
6@Table({ 8@Table({
7 tableName: 'videoJobInfo', 9 tableName: 'videoJobInfo',
8 indexes: [ 10 indexes: [
@@ -57,7 +59,7 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo
57 return VideoJobInfoModel.findOne({ where, transaction }) 59 return VideoJobInfoModel.findOne({ where, transaction })
58 } 60 }
59 61
60 static async increaseOrCreate (videoUUID: string, column: 'pendingMove' | 'pendingTranscode'): Promise<number> { 62 static async increaseOrCreate (videoUUID: string, column: VideoJobInfoColumnType): Promise<number> {
61 const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } 63 const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } }
62 64
63 const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` 65 const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(`
@@ -79,7 +81,7 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo
79 return pendingMove 81 return pendingMove
80 } 82 }
81 83
82 static async decrease (videoUUID: string, column: 'pendingMove' | 'pendingTranscode'): Promise<number> { 84 static async decrease (videoUUID: string, column: VideoJobInfoColumnType): Promise<number> {
83 const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } 85 const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } }
84 86
85 const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` 87 const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(`