From 91f6f169b1110eeae6ebf5c387f4204b0d07703c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Sep 2017 14:17:46 +0200 Subject: Fix concurrency error when deleting a video --- server/models/video/video.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/models/video') 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) { }) } -function afterDestroy (video: VideoInstance) { +function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.Transaction }) { const tasks = [] tasks.push( @@ -314,10 +314,10 @@ function afterDestroy (video: VideoInstance) { tasks.push( video.removePreview(), - removeVideoToFriends(removeVideoToFriendsParams) + removeVideoToFriends(removeVideoToFriendsParams, options.transaction) ) - // TODO: check files is populated + // Remove physical files and torrents video.VideoFiles.forEach(file => { video.removeFile(file), video.removeTorrent(file) -- cgit v1.2.3