From dbd9fb44ddd880622265097bd7baf4dd71ea0861 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Dec 2021 11:09:31 +0100 Subject: Don't stuck state when move transcoding job failed --- scripts/create-move-video-storage-job.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/create-move-video-storage-job.ts b/scripts/create-move-video-storage-job.ts index 699487f72..90c84b1d7 100644 --- a/scripts/create-move-video-storage-job.ts +++ b/scripts/create-move-video-storage-job.ts @@ -4,7 +4,7 @@ registerTSPaths() import { program } from 'commander' import { VideoModel } from '@server/models/video/video' import { initDatabaseModels } from '@server/initializers/database' -import { VideoStorage } from '@shared/models' +import { VideoState, VideoStorage } from '@shared/models' import { moveToExternalStorageState } from '@server/lib/video-state' import { JobQueue } from '@server/lib/job-queue' import { CONFIG } from '@server/initializers/config' @@ -62,6 +62,11 @@ async function run () { process.exit(-1) } + if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) { + console.error('This video is already being moved to external storage') + process.exit(-1) + } + ids.push(video.id) } else { ids = await VideoModel.listLocalIds() -- cgit v1.2.3