Commit 6d583bcc authored by href's avatar href Committed by rinpatch

Set a default timeout for Gun adapter timeout

parent e4992750
......@@ -44,15 +44,17 @@ def maybe_add_proxy(opts, proxy), do: Keyword.put_new(opts, :proxy, proxy)
@spec options(URI.t(), keyword()) :: keyword()
def options(%URI{} = uri, opts \\ []) do
|> pool_timeout()
|> put_timeout()
|> Keyword.merge(opts)
|> adapter_helper().options(uri)
defp pool_timeout(opts) do
# For Hackney, this is the time a connection can stay idle in the pool.
# For Gun, this is the timeout to receive a message from Gun.
defp put_timeout(opts) do
{config_key, default} =
if adapter() == Tesla.Adapter.Gun do
{:pools, Config.get([:pools, :default, :timeout])}
{:pools, Config.get([:pools, :default, :timeout], 5_000)}
{:hackney_pools, 10_000}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment