From 46f7cd6837311019acef6e2086c7b006e6dbe1b9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Jul 2022 16:30:59 +0200 Subject: Fix handling broken lives We want the latest session that may already be finished --- server/lib/live/live-manager.ts | 2 +- server/models/video/video-live-session.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index 74f203091..206e30d7d 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts @@ -395,7 +395,7 @@ class LiveManager { const live = await VideoLiveModel.loadByVideoId(fullVideo.id) - const liveSession = liveSessionArg ?? await VideoLiveSessionModel.findCurrentSessionOf(fullVideo.id) + const liveSession = liveSessionArg ?? await VideoLiveSessionModel.findLatestSessionOf(fullVideo.id) // On server restart during a live if (!liveSession.endDate) { diff --git a/server/models/video/video-live-session.ts b/server/models/video/video-live-session.ts index 836620872..758906a42 100644 --- a/server/models/video/video-live-session.ts +++ b/server/models/video/video-live-session.ts @@ -107,6 +107,15 @@ export class VideoLiveSessionModel extends Model