Skip to content

fix(download): retry the metadata probe; set socket timeouts everywhere - #300

Merged
thcp merged 2 commits into
mainfrom
fix/download-metadata-retry
Jul 17, 2026
Merged

fix(download): retry the metadata probe; set socket timeouts everywhere#300
thcp merged 2 commits into
mainfrom
fix/download-metadata-retry

Conversation

@thcp

@thcp thcp commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Closes #279. Phase 2 of #273 — plan: #273 (comment) (PR-2B).

What

  • The pre-download metadata probe (extract_info(download=False) for the duration check) ran outside the retry loop — a transient blip on that one request failed the job instantly while the download itself enjoyed 3-attempt backoff. Both now share one _with_retries helper: same retriable/non-retriable lists, backoff schedule, JobCancelled translation, and user-visible "Network error — retrying (n/3)…" stage message.
  • All three YoutubeDL configs (probe, audio download, video track) now set socket_timeout: 30 explicitly, so a stalled TCP connection can never hang a job indefinitely.

The old inline download retry loop is replaced by the shared helper — behavior-preserving refactor verified by the suite.

Testing

New tests/test_download_retry.py: transient error retried then succeeds (with stage message asserted), non-retriable ("Private video") raises on attempt 1, exhausted retries re-raise, cancel mid-attempt → JobCancelled, unrecognized errors not retried. Backoff sleeps patched out.

Full suite: 185 passed; ruff clean.

🤖 Generated with Claude Code

The pre-download metadata probe (duration check) ran outside the retry
loop: a transient network blip on that single request failed the whole
job immediately, even though the actual download had a 3-attempt
backoff. The probe and the download now share one retry policy
(_with_retries), with the same retriable/non-retriable classification,
cancel translation, and user-visible "retrying" stage message.

Every YoutubeDL instance (probe, audio download, video track) now sets
an explicit 30 s socket_timeout so a stalled TCP connection can never
hang a job indefinitely.

Closes #279
Comment thread app/pipeline/download.py Dismissed
@thcp
thcp merged commit 4a3ba0f into main Jul 17, 2026
8 checks passed
@thcp
thcp deleted the fix/download-metadata-retry branch July 17, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metadata probe outside the retry loop

1 participant