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

Add timeout parameter to requests.Session.get to prevent hangs #54

Closed
wants to merge 3 commits into from

Conversation

gmertes
Copy link

@gmertes gmertes commented Sep 29, 2021

The requests package does not explicitly set a timeout on get requests. If the socket times out, it will hang indefinitely. The docs recommend you to specify a timeout.

In this PR I've added the --timeout parameter, which defaults to 10s. This parameter is added to the get request in _download.

Fixes #53

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From personal experience, I know that 10s is too small but 360 sounds more reasonable with large packages and corporate virus scanners.

conda_mirror/conda_mirror.py Outdated Show resolved Hide resolved
conda_mirror/conda_mirror.py Outdated Show resolved Hide resolved
conda_mirror/conda_mirror.py Outdated Show resolved Hide resolved
conda_mirror/conda_mirror.py Outdated Show resolved Hide resolved
conda_mirror/conda_mirror.py Outdated Show resolved Hide resolved
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.

Intermittent internet loss causes downloads to hang indefinitely
2 participants