httpx.client.send() doesn't timeout when using a new httpx.Request instance instead of client.build_request #3110
Replies: 2 comments 2 replies
-
Yes... the We either want to document this as "expected behaviour" or alter it. It could be resolved in... Line 881 in 326b943 Line 1628 in 326b943 Ensuring that the Lines 350 to 356 in 326b943 |
Beta Was this translation helpful? Give feedback.
-
I don't know the codebase well enough for this, I think some relevant questions would be:
And finally, this is more for my own curiosity, why was it implemented as a extension? So the fix would be to add this to both send methods? if "timeout" not in request.extensions:
timeout = (
self.timeout
if isinstance(timeout, UseClientDefault)
else Timeout(timeout)
)
request.extensions = dict(**request.extensions, timeout=timeout.as_dict()) I could try doing a PR, but I'm not sure if I'm the right person to do it, or knowledgeable enough. |
Beta Was this translation helpful? Give feedback.
-
I've been having situations in which under gunicorn, code like this:
Does not timeout after 30 seconds, and reaches the 60 seconds of the gunicorn worker timeout.
I created a this test script, using https://httpstat.us/ which lets you configure how long the request will take to answer
And my results are:
If you send a
httpx.Request()
not built withclient.build_request()
it doesn't seem to be a timeout at all, not even the default 5 second one.This is on 0.27.0 but it also happens in at least 0.25.2
Beta Was this translation helpful? Give feedback.
All reactions