diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-12 14:17:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-12 14:17:46 +0200 |
commit | 91f6f169b1110eeae6ebf5c387f4204b0d07703c (patch) | |
tree | cba01c954c311b8b5296222994a64da58c17789e /server/models | |
parent | 6d33593a0829a7f041127d50d4c455456550a47f (diff) | |
download | PeerTube-91f6f169b1110eeae6ebf5c387f4204b0d07703c.tar.gz PeerTube-91f6f169b1110eeae6ebf5c387f4204b0d07703c.tar.zst PeerTube-91f6f169b1110eeae6ebf5c387f4204b0d07703c.zip |
Fix concurrency error when deleting a video
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1134525f0..e011c3b4d 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -300,7 +300,7 @@ function associate (models) { | |||
300 | }) | 300 | }) |
301 | } | 301 | } |
302 | 302 | ||
303 | function afterDestroy (video: VideoInstance) { | 303 | function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.Transaction }) { |
304 | const tasks = [] | 304 | const tasks = [] |
305 | 305 | ||
306 | tasks.push( | 306 | tasks.push( |
@@ -314,10 +314,10 @@ function afterDestroy (video: VideoInstance) { | |||
314 | 314 | ||
315 | tasks.push( | 315 | tasks.push( |
316 | video.removePreview(), | 316 | video.removePreview(), |
317 | removeVideoToFriends(removeVideoToFriendsParams) | 317 | removeVideoToFriends(removeVideoToFriendsParams, options.transaction) |
318 | ) | 318 | ) |
319 | 319 | ||
320 | // TODO: check files is populated | 320 | // Remove physical files and torrents |
321 | video.VideoFiles.forEach(file => { | 321 | video.VideoFiles.forEach(file => { |
322 | video.removeFile(file), | 322 | video.removeFile(file), |
323 | video.removeTorrent(file) | 323 | video.removeTorrent(file) |