Fix handling broken lives
We want the latest session that may already be finished
This commit is contained in:
parent
4ddb53f65d
commit
46f7cd6837
|
@ -395,7 +395,7 @@ class LiveManager {
|
||||||
|
|
||||||
const live = await VideoLiveModel.loadByVideoId(fullVideo.id)
|
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
|
// On server restart during a live
|
||||||
if (!liveSession.endDate) {
|
if (!liveSession.endDate) {
|
||||||
|
|
|
@ -107,6 +107,15 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static findLatestSessionOf (videoId: number) {
|
||||||
|
return VideoLiveSessionModel.findOne({
|
||||||
|
where: {
|
||||||
|
liveVideoId: videoId
|
||||||
|
},
|
||||||
|
order: [ [ 'startDate', 'DESC' ] ]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
static listSessionsOfLiveForAPI (options: { videoId: number }) {
|
static listSessionsOfLiveForAPI (options: { videoId: number }) {
|
||||||
const { videoId } = options
|
const { videoId } = options
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user