-
Notifications
You must be signed in to change notification settings - Fork 140
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
Incorrect behavior when using timeout parameter #117
Comments
@glyph ping. |
@mlowicki this is a great bug report, thanks. Sorry we haven't gotten to it yet. I am on vacation at the moment, so perhaps post another ping next week :). |
@glyph pinging then ;) |
Thanks, looking into it now :). |
@glyph any luck? |
Upon closer inspection, this is, unfortunately, sort of the expected behavior. The good news is that since |
Hello,
I've recently ran into an issue when trying to handle request timeouts in my code.
As I understand from the documentation, when the timeout fires, the request should fail raising a
CancelledError
. However, I could not reliably catch it.Below there's a minimal example script to illustrate the problem:
As stated in the comment, the request to the test URL requires about 5 seconds to complete. Provided that the timeout is long enough (say, 10 seconds), the request indeed completes correctly:
In case the timeout is too short, I'd expect the script to print 'timeout'. Instead it raises an unhandled failure:
Make the timeout even shorter, so that the request is canceled even before establishing the connection, and it will raise different error instead:
Again, I believe that in both these cases the excepted behavior is that
treq.get
raises a CancelledError in deferred, which should be handled by the script above. Am I correct?Tested with treq 15.0.0 and Twisted 15.4.0.
The text was updated successfully, but these errors were encountered: