aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-09 11:22:42 +0100
committerChocobozzz <me@florianbigard.com>2021-02-09 11:46:30 +0100
commit44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031 (patch)
tree204dfc3e7986b9a6fc3660e47bdb93df3baeeb94 /server/models
parent80428d16a0acd1c0d1478d8861c3d5778745bb77 (diff)
downloadPeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.tar.gz
PeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.tar.zst
PeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.zip
Painfully debug concurrent import jobs
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