diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-16 13:39:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-16 13:39:57 +0200 |
commit | cdd838168d617f70fc04fe7f23846810e7e07082 (patch) | |
tree | f563eccdd927babf82d25c6f2cd8ba343fb67a21 /server/lib/job-queue/handlers/video-live-ending.ts | |
parent | bffee1d538aa7b51b78d646a0d372b352c073cd8 (diff) | |
download | PeerTube-cdd838168d617f70fc04fe7f23846810e7e07082.tar.gz PeerTube-cdd838168d617f70fc04fe7f23846810e7e07082.tar.zst PeerTube-cdd838168d617f70fc04fe7f23846810e7e07082.zip |
Fix live ending job that breaks new live session
Diffstat (limited to 'server/lib/job-queue/handlers/video-live-ending.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-live-ending.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 7607267f8..feec257fc 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -45,13 +45,13 @@ async function processVideoLiveEnding (job: Job) { | |||
45 | LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid) | 45 | LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid) |
46 | 46 | ||
47 | if (live.saveReplay !== true) { | 47 | if (live.saveReplay !== true) { |
48 | return cleanupLiveAndFederate({ live, video: liveVideo }) | 48 | return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId }) |
49 | } | 49 | } |
50 | 50 | ||
51 | if (live.permanentLive) { | 51 | if (live.permanentLive) { |
52 | await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory }) | 52 | await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory }) |
53 | 53 | ||
54 | return cleanupLiveAndFederate({ live, video: liveVideo }) | 54 | return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId }) |
55 | } | 55 | } |
56 | 56 | ||
57 | return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory }) | 57 | return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory }) |
@@ -233,15 +233,18 @@ async function assignReplayFilesToVideo (options: { | |||
233 | async function cleanupLiveAndFederate (options: { | 233 | async function cleanupLiveAndFederate (options: { |
234 | live: MVideoLive | 234 | live: MVideoLive |
235 | video: MVideo | 235 | video: MVideo |
236 | streamingPlaylistId: number | ||
236 | }) { | 237 | }) { |
237 | const { live, video } = options | 238 | const { live, video, streamingPlaylistId } = options |
238 | 239 | ||
239 | const streamingPlaylist = await VideoStreamingPlaylistModel.loadHLSPlaylistByVideo(video.id) | 240 | const streamingPlaylist = await VideoStreamingPlaylistModel.loadWithVideo(streamingPlaylistId) |
240 | 241 | ||
241 | if (live.permanentLive) { | 242 | if (streamingPlaylist) { |
242 | await cleanupPermanentLive(video, streamingPlaylist) | 243 | if (live.permanentLive) { |
243 | } else { | 244 | await cleanupPermanentLive(video, streamingPlaylist) |
244 | await cleanupNormalLive(video, streamingPlaylist) | 245 | } else { |
246 | await cleanupNormalLive(video, streamingPlaylist) | ||
247 | } | ||
245 | } | 248 | } |
246 | 249 | ||
247 | try { | 250 | try { |