wojtekmach / req

Req is a batteries-included HTTP client for Elixir.
https://hexdocs.pm/req
Apache License 2.0
1.09k stars 117 forks source link

Please how do we limit total-request/ response time? #427

Closed CharlesOkwuagwu closed 4 weeks ago

CharlesOkwuagwu commented 1 month ago

Please how do we limit the total request/response time to a fixed value?

This below does not work in limiting the total request/respose time

Req.get!("https://httpbin.org", connect_options: [timeout: 2000])

wojtekmach commented 4 weeks ago

At the moment the best option is to wrap your Req call in Task.async(fun) |> Task.await(timeout). This is not good enough obviously, we will improve it, it's being tracked in https://github.com/wojtekmach/req/issues/428.