diff options
Diffstat (limited to 'server/models')
-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> { |