From 9fd540562c356cb54b98861d2d9e7d4fbfcd00e0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Oct 2017 09:28:35 +0200 Subject: Fix video removing when it is corrupted --- server/models/video/video.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/models/video/video.ts b/server/models/video/video.ts index fb18a485a..4bd8eb98f 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -334,12 +334,15 @@ function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.T // Remove physical files and torrents video.VideoFiles.forEach(file => { - video.removeFile(file), - video.removeTorrent(file) + tasks.push(video.removeFile(file)) + tasks.push(video.removeTorrent(file)) }) } return Promise.all(tasks) + .catch(err => { + logger.error('Some errors when removing files of video %d in after destroy hook.', video.uuid, err) + }) } getOriginalFile = function (this: VideoInstance) { -- cgit v1.2.3