tsyesika/PyPump

Handle timeout on requests

Closed this issue · 4 comments

When identi.ca falls down (which happens quite regularily), using note.send() seems to hang indefinitely, it would be nice to have a timeout argument and return an error, timeoutexception or none when this happens.

We do actually have a timeout, i believe it's 30 seconds request however we by default attempt the request 10 times before we raise the exception. I agree that waiting 5 minutes (30 seconds * 10) for an exception to be raised is not acceptable, I may remove the attempts and allow the client to catch the timeout exception and re-try.

That would be great! Thanks in advance!

I've reduced the default number of requests to 1, it seems that the default was actually 3 so that was only a minute and a half, I'm surprised that you never saw a timeout raised as that's only a minute and a half (3 * 30). Please re-open this bug if you still think the problem exists and I'll investigate further.

Where is the timeout value being set? As far as I can see, requests relies on the Python default unless otherwise specified. I think allowing the user to pass in their own timeout value would be the best option.