From 3256771725430ab6fc716e937b88ca2b2b85263b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 16 Jun 2022 14:29:53 +0200 Subject: More robust move to object storage job failure --- server/lib/job-queue/handlers/move-to-object-storage.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'server/lib/job-queue/handlers/move-to-object-storage.ts') diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts index f480b32cd..49064052c 100644 --- a/server/lib/job-queue/handlers/move-to-object-storage.ts +++ b/server/lib/job-queue/handlers/move-to-object-storage.ts @@ -48,15 +48,24 @@ export async function processMoveToObjectStorage (job: Job) { await doAfterLastJob({ video, previousVideoState: payload.previousVideoState, isNewVideo: payload.isNewVideo }) } } catch (err) { - logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTags }) - - await moveToFailedMoveToObjectStorageState(video) - await VideoJobInfoModel.abortAllTasks(video.uuid, 'pendingMove') + await onMoveToObjectStorageFailure(job, err) } return payload.videoUUID } +export async function onMoveToObjectStorageFailure (job: Job, err: any) { + const payload = job.data as MoveObjectStoragePayload + + const video = await VideoModel.loadWithFiles(payload.videoUUID) + if (!video) return + + logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTagsBase(video.uuid, video.url) }) + + await moveToFailedMoveToObjectStorageState(video) + await VideoJobInfoModel.abortAllTasks(video.uuid, 'pendingMove') +} + // --------------------------------------------------------------------------- async function moveWebTorrentFiles (video: MVideoWithAllFiles) { -- cgit v1.2.3