1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

More robust move to object storage job failure

This commit is contained in:
Chocobozzz 2022-06-16 14:29:53 +02:00
parent 0c9a835466
commit 3256771725
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 23 additions and 5 deletions

View file

@ -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) {