Add timeout to prevent API calls from never returning#41
Add timeout to prevent API calls from never returning#41balloob wants to merge 1 commit intoZeevG:masterfrom
Conversation
|
@balloob @fabaff Are you able to tell me a bit more about why you need this timeout? I'm a bit hesitant to add a fixed timeout in case it is unsuitable for some applications. I could make it an option but I don't want to pollute the API with unnecessary, rarely used options. Most http proxies will close the connection if the application server doesn't respond within a certain time limit, usually around 30 - 60 seconds. I don't know for certain but I'd expect the Dark Sky API would do this. |
|
The requests are not pooled or re-used, as in a session, so it doesn't make much sense to keep them long-running. |
It's not a good idea to rely on the other party to prevent your program from getting blocked. I don't mind setting it to 60 seconds if that is fine. In the end, you want some sort of timeout or else the program might never unblock. |
This PR adds a 10 second timeout to prevent requests from staying open forever.