aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-job-info.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-23 11:09:31 +0100
committerChocobozzz <me@florianbigard.com>2021-12-23 11:13:06 +0100
commitdbd9fb44ddd880622265097bd7baf4dd71ea0861 (patch)
treeb531f861026a52bcacfdee076431c1c34d9ba78d /server/models/video/video-job-info.ts
parent482b26231b4e39234f107b8400ef606c5f003c55 (diff)
downloadPeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.tar.gz
PeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.tar.zst
PeerTube-dbd9fb44ddd880622265097bd7baf4dd71ea0861.zip
Don't stuck state when move transcoding job failed
Diffstat (limited to 'server/models/video/video-job-info.ts')
-rw-r--r--server/models/video/video-job-info.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/models/video/video-job-info.ts b/server/models/video/video-job-info.ts
index 6a67a214c..7497addf1 100644
--- a/server/models/video/video-job-info.ts
+++ b/server/models/video/video-job-info.ts
@@ -99,4 +99,19 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo
99 99
100 return pendingMove 100 return pendingMove
101 } 101 }
102
103 static async abortAllTasks (videoUUID: string, column: VideoJobInfoColumnType): Promise<void> {
104 const options = { type: QueryTypes.UPDATE as QueryTypes.UPDATE, bind: { videoUUID } }
105
106 await VideoJobInfoModel.sequelize.query(`
107 UPDATE
108 "videoJobInfo"
109 SET
110 "${column}" = 0,
111 "updatedAt" = NOW()
112 FROM "video"
113 WHERE
114 "video"."id" = "videoJobInfo"."videoId" AND "video"."uuid" = $videoUUID
115 `, options)
116 }
102} 117}