-
Notifications
You must be signed in to change notification settings - Fork 71
Req adapter: respect connect_timeout + recv_timeout client options for timeout #238
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,13 +94,20 @@ if Code.ensure_loaded?(Req) do | |
end | ||
|
||
defp async_request(req, parent) do | ||
connect_timeout = | ||
req.options | ||
|> Keyword.get(:connect_options, []) | ||
|> Keyword.get(:timeout, 30_000) | ||
|
||
recv_timeout = Keyword.get(req.options, :recv_timeout, 15_000) | ||
|
||
fn -> | ||
ret = request(req) | ||
send(parent, :eof) | ||
ret | ||
end | ||
|> Task.async() | ||
|> Task.await() | ||
|> Task.await(connect_timeout + recv_timeout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do wonder if the timeout here should just be Also worth considering... why even run this in a task if we're immediately There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put up another PR which removes the |
||
end | ||
|
||
defp body_stream do | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the option for req is
:receive_timeout
not:recv_timeout
https://hexdocs.pm/req/Req.html#new/1