diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-10 14:51:11 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-10 14:51:11 +0200 |
commit | 52d6c2e0bf0893e39d0a89fccebad684e9d61ce5 (patch) | |
tree | c821e0e419fadbde0e664da01bc1ab85de4afd2f /server/models/video | |
parent | 1a3b53de6f39d0301c48d47d53cca3eb7cd60197 (diff) | |
download | PeerTube-52d6c2e0bf0893e39d0a89fccebad684e9d61ce5.tar.gz PeerTube-52d6c2e0bf0893e39d0a89fccebad684e9d61ce5.tar.zst PeerTube-52d6c2e0bf0893e39d0a89fccebad684e9d61ce5.zip |
Fix video job error when video has been deleted
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-job-info.ts | 6 |
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 7497addf1..740f6b5c6 100644 --- a/server/models/video/video-job-info.ts +++ b/server/models/video/video-job-info.ts | |||
@@ -84,7 +84,7 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo | |||
84 | static async decrease (videoUUID: string, column: VideoJobInfoColumnType): Promise<number> { | 84 | static async decrease (videoUUID: string, column: VideoJobInfoColumnType): Promise<number> { |
85 | const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } | 85 | const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } |
86 | 86 | ||
87 | const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` | 87 | const result = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` |
88 | UPDATE | 88 | UPDATE |
89 | "videoJobInfo" | 89 | "videoJobInfo" |
90 | SET | 90 | SET |
@@ -97,7 +97,9 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo | |||
97 | "${column}"; | 97 | "${column}"; |
98 | `, options) | 98 | `, options) |
99 | 99 | ||
100 | return pendingMove | 100 | if (result.length === 0) return undefined |
101 | |||
102 | return result[0].pendingMove | ||
101 | } | 103 | } |
102 | 104 | ||
103 | static async abortAllTasks (videoUUID: string, column: VideoJobInfoColumnType): Promise<void> { | 105 | static async abortAllTasks (videoUUID: string, column: VideoJobInfoColumnType): Promise<void> { |