From 8bd6aa0424a034166a6b1a63fe4660140246bbb2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Oct 2022 14:20:19 +0200 Subject: [PATCH] Also retry when fetching master m3u8 playlist --- server/tests/shared/live.ts | 10 +++++++--- server/tests/shared/streaming-playlists.ts | 5 +++-- shared/server-commands/videos/live.ts | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts index f165832fe..63f3ecfd8 100644 --- a/server/tests/shared/live.ts +++ b/server/tests/shared/live.ts @@ -3,7 +3,6 @@ import { expect } from 'chai' import { pathExists, readdir } from 'fs-extra' import { join } from 'path' -import { wait } from '@shared/core-utils' import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models' import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' @@ -42,7 +41,13 @@ async function testVideoResolutions (options: { expect(hlsPlaylist).to.exist expect(hlsPlaylist.files).to.have.lengthOf(0) // Only fragmented mp4 files are displayed - await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions, transcoded }) + await checkResolutionsInMasterPlaylist({ + server, + playlistUrl: hlsPlaylist.playlistUrl, + resolutions, + transcoded, + withRetry: objectStorage + }) if (objectStorage) { expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) @@ -59,7 +64,6 @@ async function testVideoResolutions (options: { if (objectStorage) { await originServer.live.waitUntilSegmentUpload({ playlistNumber: i, segment: segmentNum }) - await wait(1000) expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) } diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts index eff34944b..74c25e99c 100644 --- a/server/tests/shared/streaming-playlists.ts +++ b/server/tests/shared/streaming-playlists.ts @@ -57,10 +57,11 @@ async function checkResolutionsInMasterPlaylist (options: { playlistUrl: string resolutions: number[] transcoded?: boolean // default true + withRetry?: boolean // default false }) { - const { server, playlistUrl, resolutions, transcoded = true } = options + const { server, playlistUrl, resolutions, withRetry = false, transcoded = true } = options - const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl }) + const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl, withRetry }) for (const resolution of resolutions) { const reg = transcoded diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts index 6f180b05f..0d9c32aab 100644 --- a/shared/server-commands/videos/live.ts +++ b/shared/server-commands/videos/live.ts @@ -1,7 +1,7 @@ import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' -import { PeerTubeServer } from '../server/server' import { VideoDetails, VideoInclude } from '@shared/models' +import { PeerTubeServer } from '../server/server' function sendRTMPStream (options: { rtmpBaseUrl: string