aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-import.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index f3ed651b2..8324166cc 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -21,6 +21,7 @@ import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/cons
21import { UserModel } from '../account/user' 21import { UserModel } from '../account/user'
22import { getSort, throwIfNotValid } from '../utils' 22import { getSort, throwIfNotValid } from '../utils'
23import { ScopeNames as VideoModelScopeNames, VideoModel } from './video' 23import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'
24import { afterCommitIfTransaction } from '@server/helpers/database-utils'
24 25
25@DefaultScope(() => ({ 26@DefaultScope(() => ({
26 include: [ 27 include: [
@@ -113,7 +114,7 @@ export class VideoImportModel extends Model {
113 @AfterUpdate 114 @AfterUpdate
114 static deleteVideoIfFailed (instance: VideoImportModel, options) { 115 static deleteVideoIfFailed (instance: VideoImportModel, options) {
115 if (instance.state === VideoImportState.FAILED) { 116 if (instance.state === VideoImportState.FAILED) {
116 return instance.Video.destroy({ transaction: options.transaction }) 117 return afterCommitIfTransaction(options.transaction, () => instance.Video.destroy())
117 } 118 }
118 119
119 return undefined 120 return undefined