]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Also retry when fetching master m3u8 playlist
authorChocobozzz <me@florianbigard.com>
Tue, 11 Oct 2022 12:20:19 +0000 (14:20 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 11 Oct 2022 12:33:42 +0000 (14:33 +0200)
server/tests/shared/live.ts
server/tests/shared/streaming-playlists.ts
shared/server-commands/videos/live.ts

index f165832fe7c29fb6a219cce1ec882712a5c572ab..63f3ecfd8cd0c73644d4d7cb286e597d717f47bc 100644 (file)
@@ -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())
       }
index eff34944b5f9ba9736703abab0f1e5cc2966a4f2..74c25e99c7bdff657166c2bc5cd62339d85b9c89 100644 (file)
@@ -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
index 6f180b05f0a2aefb01397ee54f2d6418276a8823..0d9c32aab4df20d9b2f07853d8f649bd4bc3ca87 100644 (file)
@@ -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