From 51335c72cf1119a92901edeaa5c7dfc1feef3ca4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Aug 2022 13:21:18 +0200 Subject: Prevent job failure on concurrent HLS transcoding --- server/lib/hls.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'server/lib/hls.ts') diff --git a/server/lib/hls.ts b/server/lib/hls.ts index ad29e4c90..9ec931b4f 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts @@ -35,15 +35,19 @@ async function updateStreamingPlaylistsInfohashesIfNeeded () { } async function updatePlaylistAfterFileChange (video: MVideo, playlist: MStreamingPlaylist) { - let playlistWithFiles = await updateMasterHLSPlaylist(video, playlist) - playlistWithFiles = await updateSha256VODSegments(video, playlist) - - // Refresh playlist, operations can take some time - playlistWithFiles = await VideoStreamingPlaylistModel.loadWithVideoAndFiles(playlist.id) - playlistWithFiles.assignP2PMediaLoaderInfoHashes(video, playlistWithFiles.VideoFiles) - await playlistWithFiles.save() - - video.setHLSPlaylist(playlistWithFiles) + try { + let playlistWithFiles = await updateMasterHLSPlaylist(video, playlist) + playlistWithFiles = await updateSha256VODSegments(video, playlist) + + // Refresh playlist, operations can take some time + playlistWithFiles = await VideoStreamingPlaylistModel.loadWithVideoAndFiles(playlist.id) + playlistWithFiles.assignP2PMediaLoaderInfoHashes(video, playlistWithFiles.VideoFiles) + await playlistWithFiles.save() + + video.setHLSPlaylist(playlistWithFiles) + } catch (err) { + logger.info('Cannot update playlist after file change. Maybe due to concurrent transcoding', { err }) + } } // --------------------------------------------------------------------------- -- cgit v1.2.3