chore(downloads): log failed resolutions and tighten retry dataclass/tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -119,7 +119,7 @@ def _extract_vanity_from_url(url: str) -> Optional[str]:
|
||||
class _DownloadAttempt:
|
||||
"""Result of executing a download, possibly with a retry after campaign-ID resolution."""
|
||||
dl_result: DownloadResult
|
||||
resolved_campaign_id: Optional[str]
|
||||
resolved_campaign_id: Optional[str] = None
|
||||
|
||||
|
||||
async def _execute_download_with_retry(
|
||||
@@ -176,6 +176,11 @@ async def _execute_download_with_retry(
|
||||
return _DownloadAttempt(
|
||||
dl_result=retry_result, resolved_campaign_id=campaign_id
|
||||
)
|
||||
else:
|
||||
logger.warning(
|
||||
f"Could not resolve campaign ID for {subscription_name}/patreon ({vanity}); "
|
||||
f"original failure will be recorded"
|
||||
)
|
||||
|
||||
return _DownloadAttempt(dl_result=dl_result, resolved_campaign_id=None)
|
||||
|
||||
|
||||
@@ -197,6 +197,7 @@ async def test_unextractable_vanity_skips_retry(monkeypatch):
|
||||
)
|
||||
|
||||
assert result.dl_result is failure
|
||||
assert result.resolved_campaign_id is None
|
||||
resolver_mock.assert_not_called()
|
||||
assert gdl.download.call_count == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user