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 timeouts to requests.get #3300

Merged
merged 3 commits into from
Mar 2, 2024
Merged

Add timeouts to requests.get #3300

merged 3 commits into from
Mar 2, 2024

Conversation

MaggieFero
Copy link
Contributor

Two instances of requests.get are currently missing timeouts. Without an explicit timeout, requests.get will never time out, which can cause code to hang.

Some instances of requests.get in other parts of the code did have timeouts, in one instance configurable and in all others 15. The missing instances felt more analogous to the place where it was already 15 than the configurable one, so this PR adds timeouts of 15 in the two places that currently lack a timeout.

The phildini/bookwyrm fork is already successfully running with these changes in production, but we've done a bunch of infrastructure stuff recently as well, so I made a new fork to submit a cleaner PR to yall.

An instance of requests.get in isbn.py lacks a timeout, and this commit adds one with a default of 15 as used other places in the code, where requests.get does already have a timeout.
An instance of requests.get was missing a timeout; this commit adds a timeout of 15 as used in other places in this codebase which already have timeouts.
Add a comma
@mouse-reeve
Copy link
Member

Thank you, these should definitely have timeouts! I think we should move all instances of timeouts to the one set by the environment variable, but since that would be a bigger change than this, it seems like a good call to make that a separate task.

@mouse-reeve mouse-reeve merged commit 218171e into bookwyrm-social:main Mar 2, 2024
10 checks passed
@MaggieFero MaggieFero deleted the MaggieFero-add-timeouts-to-requests.get branch March 2, 2024 22:33
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