Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[downloader/http] Retry download when urlopen times out #26603

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

salty-horse
Copy link
Contributor

@salty-horse salty-horse commented Sep 16, 2020

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

When the http downloader's urlopen times out, it used to stop the program with the timeout error, disrespecting the user's retry count settings. This fix addresses that, by having a timeout trigger a retry.

I've tested it on Python 2.7.18 and 3.8.2.

While I think the fix is a useful thing to have in general, it addresses a specific issue I have, and described in #25183. That bug, however, was closed as a duplicate without any explanation or reference to a duplicate bug, so I never found out if there was any existing discussion about it.

Many times when the dash downloader is used to download youtube videos, my download would time out every 1-3 fragments. This means I would have to re-run the command over and over again.
With the timeout retry fix, the dash fragments that get a timeout are immediately retried, and the download eventually completes without any visible errors, or me having to restart it. (Note that for a smooth download I need to run it with a shortened socket-timeout, because the default of 20 seconds is too much for this particular use-case).

@dstftw dstftw merged commit 86b7c00 into ytdl-org:master Sep 17, 2020
@salty-horse salty-horse deleted the urlopen_timeout_retry branch September 17, 2020 22:28
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.

2 participants