aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-16 14:29:53 +0200
committerChocobozzz <me@florianbigard.com>2022-06-16 14:29:53 +0200
commit3256771725430ab6fc716e937b88ca2b2b85263b (patch)
tree5ab8e20c9646740cd12151592541af6997ca6d63 /server/lib/job-queue/handlers
parent0c9a83546687d2ae80b3f5299a8ee59d741f894f (diff)
downloadPeerTube-3256771725430ab6fc716e937b88ca2b2b85263b.tar.gz
PeerTube-3256771725430ab6fc716e937b88ca2b2b85263b.tar.zst
PeerTube-3256771725430ab6fc716e937b88ca2b2b85263b.zip
More robust move to object storage job failure
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts17
1 files changed, 13 insertions, 4 deletions
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) {
48 await doAfterLastJob({ video, previousVideoState: payload.previousVideoState, isNewVideo: payload.isNewVideo }) 48 await doAfterLastJob({ video, previousVideoState: payload.previousVideoState, isNewVideo: payload.isNewVideo })
49 } 49 }
50 } catch (err) { 50 } catch (err) {
51 logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTags }) 51 await onMoveToObjectStorageFailure(job, err)
52
53 await moveToFailedMoveToObjectStorageState(video)
54 await VideoJobInfoModel.abortAllTasks(video.uuid, 'pendingMove')
55 } 52 }
56 53
57 return payload.videoUUID 54 return payload.videoUUID
58} 55}
59 56
57export async function onMoveToObjectStorageFailure (job: Job, err: any) {
58 const payload = job.data as MoveObjectStoragePayload
59
60 const video = await VideoModel.loadWithFiles(payload.videoUUID)
61 if (!video) return
62
63 logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTagsBase(video.uuid, video.url) })
64
65 await moveToFailedMoveToObjectStorageState(video)
66 await VideoJobInfoModel.abortAllTasks(video.uuid, 'pendingMove')
67}
68
60// --------------------------------------------------------------------------- 69// ---------------------------------------------------------------------------
61 70
62async function moveWebTorrentFiles (video: MVideoWithAllFiles) { 71async function moveWebTorrentFiles (video: MVideoWithAllFiles) {