mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-22 00:45:10 +00:00
fix(downloader): report spent segment retries in one line without the URL
The session message names the host, not the signed URL, and a segment that fails every attempt prints one line with no traceback. API job errors come from the exception.
This commit is contained in:
@@ -27,3 +27,11 @@ def test_retry_log_counts_only_real_retries(rate_limited, caplog, max_retries):
|
||||
|
||||
retries = [r.getMessage() for r in caplog.records if "Retrying" in r.getMessage()]
|
||||
assert retries == [f"429 Too Many Requests(/x). Retrying... ({n}/{max_retries})" for n in range(1, max_retries + 1)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("max_retries", "attempts"), [(0, ""), (2, " after 3 attempts")])
|
||||
def test_spent_budget_names_the_attempts_and_host_not_the_url(rate_limited, max_retries, attempts):
|
||||
with pytest.raises(MaxRetriesError) as raised:
|
||||
rate_limited.get("https://example.invalid/x?hmac=secret", max_retries=max_retries)
|
||||
|
||||
assert str(raised.value) == f"GET example.invalid failed{attempts}: 429 Too Many Requests"
|
||||
|
||||
Reference in New Issue
Block a user