diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-15 15:41:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-15 15:42:16 +0200 |
commit | 261dac403a6380ea46f4f0bee8d50c6f661fbdfa (patch) | |
tree | fa90fdc94a54a16154ff3511ae3a92ac95fe1179 /shared/server-commands | |
parent | 5a05c14573ca3c0d16b77bef78d845f96c8c6497 (diff) | |
download | PeerTube-261dac403a6380ea46f4f0bee8d50c6f661fbdfa.tar.gz PeerTube-261dac403a6380ea46f4f0bee8d50c6f661fbdfa.tar.zst PeerTube-261dac403a6380ea46f4f0bee8d50c6f661fbdfa.zip |
More robust test
Diffstat (limited to 'shared/server-commands')
-rw-r--r-- | shared/server-commands/videos/streaming-playlists-command.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shared/server-commands/videos/streaming-playlists-command.ts b/shared/server-commands/videos/streaming-playlists-command.ts index 87aacc5f6..b988ac4b2 100644 --- a/shared/server-commands/videos/streaming-playlists-command.ts +++ b/shared/server-commands/videos/streaming-playlists-command.ts | |||
@@ -14,7 +14,7 @@ export class StreamingPlaylistsCommand extends AbstractCommand { | |||
14 | withRetry?: boolean // default false | 14 | withRetry?: boolean // default false |
15 | currentRetry?: number | 15 | currentRetry?: number |
16 | }): Promise<string> { | 16 | }): Promise<string> { |
17 | const { videoFileToken, reinjectVideoFileToken, withRetry = false, currentRetry = 1 } = options | 17 | const { videoFileToken, reinjectVideoFileToken, expectedStatus, withRetry = false, currentRetry = 1 } = options |
18 | 18 | ||
19 | try { | 19 | try { |
20 | const result = await unwrapTextOrDecode(this.getRawRequest({ | 20 | const result = await unwrapTextOrDecode(this.getRawRequest({ |
@@ -29,6 +29,11 @@ export class StreamingPlaylistsCommand extends AbstractCommand { | |||
29 | defaultExpectedStatus: HttpStatusCode.OK_200 | 29 | defaultExpectedStatus: HttpStatusCode.OK_200 |
30 | })) | 30 | })) |
31 | 31 | ||
32 | // master.m3u8 could be empty | ||
33 | if (!result && (!expectedStatus || expectedStatus === HttpStatusCode.OK_200)) { | ||
34 | throw new Error('Empty result') | ||
35 | } | ||
36 | |||
32 | return result | 37 | return result |
33 | } catch (err) { | 38 | } catch (err) { |
34 | if (!withRetry || currentRetry > 10) throw err | 39 | if (!withRetry || currentRetry > 10) throw err |