diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-09 11:22:42 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-09 11:46:30 +0100 |
commit | 44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031 (patch) | |
tree | 204dfc3e7986b9a6fc3660e47bdb93df3baeeb94 /server/models/video | |
parent | 80428d16a0acd1c0d1478d8861c3d5778745bb77 (diff) | |
download | PeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.tar.gz PeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.tar.zst PeerTube-44d1f7f2e8119b8da6a11c3a7b9ef1dd5315d031.zip |
Painfully debug concurrent import jobs
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-import.ts | 3 |
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 | |||
21 | import { UserModel } from '../account/user' | 21 | import { UserModel } from '../account/user' |
22 | import { getSort, throwIfNotValid } from '../utils' | 22 | import { getSort, throwIfNotValid } from '../utils' |
23 | import { ScopeNames as VideoModelScopeNames, VideoModel } from './video' | 23 | import { ScopeNames as VideoModelScopeNames, VideoModel } from './video' |
24 | import { 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 |