aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/live/live-manager.ts2
-rw-r--r--server/models/video/video-live-session.ts9
2 files changed, 10 insertions, 1 deletions
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 {
395 395
396 const live = await VideoLiveModel.loadByVideoId(fullVideo.id) 396 const live = await VideoLiveModel.loadByVideoId(fullVideo.id)
397 397
398 const liveSession = liveSessionArg ?? await VideoLiveSessionModel.findCurrentSessionOf(fullVideo.id) 398 const liveSession = liveSessionArg ?? await VideoLiveSessionModel.findLatestSessionOf(fullVideo.id)
399 399
400 // On server restart during a live 400 // On server restart during a live
401 if (!liveSession.endDate) { 401 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<Partial<AttributesOnly<VideoLiv
107 }) 107 })
108 } 108 }
109 109
110 static findLatestSessionOf (videoId: number) {
111 return VideoLiveSessionModel.findOne({
112 where: {
113 liveVideoId: videoId
114 },
115 order: [ [ 'startDate', 'DESC' ] ]
116 })
117 }
118
110 static listSessionsOfLiveForAPI (options: { videoId: number }) { 119 static listSessionsOfLiveForAPI (options: { videoId: number }) {
111 const { videoId } = options 120 const { videoId } = options
112 121