From eb8da03d1ca80dd143a85c006caa657488296594 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 31 Oct 2022 08:51:52 +0100 Subject: [PATCH] Prevent error in update scheduler --- server/lib/schedulers/update-videos-scheduler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts index 30bf189db..e38685c04 100644 --- a/server/lib/schedulers/update-videos-scheduler.ts +++ b/server/lib/schedulers/update-videos-scheduler.ts @@ -53,7 +53,7 @@ export class UpdateVideosScheduler extends AbstractScheduler { const video = await sequelizeTypescript.transaction(async t => { const video = await VideoModel.loadFull(schedule.videoId, t) - if (video.state === VideoState.TO_TRANSCODE) return + if (video.state === VideoState.TO_TRANSCODE) return null logger.info('Executing scheduled video update on %s.', video.uuid) @@ -74,6 +74,10 @@ export class UpdateVideosScheduler extends AbstractScheduler { return video }) + if (!video) { + return { video, published: false } + } + await addVideoJobsAfterUpdate({ video, oldPrivacy, isNewVideo, nameChanged: false }) return { video, published }