fut
fut copied to clipboard
Timeout
I noticed last night that for some reason a few requests made were just hanging for couple of hours for some reason, before an ExpiredSession gets raised. It would be great if when making requests to the server there is someway to specify a timeout, so that if the server just hangs, we don't wait indefinitely.
I was sure requests has default timeout but looks like it's not set at all, thanks for pointing out.
TODO:
- make use of Timeout exception
- some kind od retrying connection feature
- use global timeout param when avaible (https://github.com/kennethreitz/requests/issues/3070)
Thanks!
I'll reopen this until todo is complete :-)
@oczkers "some kind of retrying connection feature".
I do it in my bot catching exceptions and making it restart after 15 minutes for example. I'm able to do it, because I have the login information in my database, so, when I need to reconnect, I just have to connect to the database, retrieve login information and try again.
The API doesn't save login information (and it's right for doing it), so, how could it reconnnect when something interrupt the connection ?
@converge
I do it in my bot catching exceptions and making it restart after 15 minutes for example.
I meant waiting x seconds and retrying for x times and if finally all that fails then throw exception. One bad request is definitely not enought to crash whole application.