Content-Length: 256095 | pFad | https://github.com/moehmeni/syncedlyrics/pull/44

80 added 10 second timeout to requests by jmaximusix · Pull Request #44 · moehmeni/syncedlyrics · GitHub
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

added 10 second timeout to requests #44

Merged
merged 3 commits into from
Jun 5, 2024
Merged

Conversation

jmaximusix
Copy link
Contributor

Added 10 second timeout to requests so the program doesn't get stuck indefinitely when a provider is temporarily unavailable

@moehmeni
Copy link
Owner

moehmeni commented Jun 5, 2024

Thanks for the contribution!
It would be great to have a general get method in the base class and replace all session.get to that method so we have just one function for making any request since I have called self.session.get in different providers.

@jmaximusix
Copy link
Contributor Author

You're right, sadly there doesn't appear to be a built-in option to set a default timeout, but by creating the TimeoutSession class which inherits from requests.Session and overrides the request method, this should now be the default for all requests and can still be overridden by the keyword argument.

I also just learned that you can seperate the timeout into connect and read timeouts, This reduces the time it takes to timeout if a provider is temporarily down and therefore no connection is made. I now set 2 seconds as the default to connect and an additional 5 seconds to read, but feel free to change these values if you want.

@moehmeni
Copy link
Owner

moehmeni commented Jun 5, 2024

That's great! thanks.

@moehmeni moehmeni merged commit 738f015 into moehmeni:main Jun 5, 2024
6 checks passed
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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/moehmeni/syncedlyrics/pull/44

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy