From 5b9b403a206e84342edfff536f0b30167976e80e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 7 Dec 2020 10:00:34 +0100 Subject: [PATCH] Fix replay last segments loop --- .../lib/job-queue/handlers/video-live-ending.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 6a675b0ef..93d925830 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts @@ -69,18 +69,9 @@ async function saveLive (video: MVideo, live: MVideoLive) { const rootFiles = await readdir(hlsDirectory) - const playlistFiles: string[] = [] - - for (const file of rootFiles) { - // Move remaining files in the replay directory - if (file.endsWith('.ts')) { - await LiveManager.Instance.addSegmentToReplay(hlsDirectory, join(hlsDirectory, file)) - } - - if (file.endsWith('.m3u8') && file !== 'master.m3u8') { - playlistFiles.push(file) - } - } + const playlistFiles = rootFiles.filter(file => { + return file.endsWith('.m3u8') && file !== 'master.m3u8' + }) await cleanupLiveFiles(hlsDirectory)