Retry transient HLS network failures
This commit is contained in:
@@ -420,6 +420,20 @@ def fetch_bytes_with_retries(url, headers=None, timeout=30, retries=None, retry_
|
||||
)
|
||||
if delay:
|
||||
time.sleep(delay)
|
||||
except (urllib.error.URLError, TimeoutError, ConnectionError) as exc:
|
||||
if attempt >= attempts:
|
||||
raise
|
||||
delay = base_delay * (2 ** attempt)
|
||||
if max_delay:
|
||||
delay = min(delay, max_delay)
|
||||
print(
|
||||
f"{retry_label} had a temporary network failure; retrying in {delay:.1f}s "
|
||||
f"({attempt + 1}/{attempts}): {exc}",
|
||||
file=sys.stderr,
|
||||
flush=True,
|
||||
)
|
||||
if delay:
|
||||
time.sleep(delay)
|
||||
|
||||
|
||||
def segment_download_delay_seconds():
|
||||
|
||||
Reference in New Issue
Block a user