hackney pool timeout

This commit is contained in:
Alexander Strizhakov 2020-02-21 14:33:55 +03:00
parent 6806df80dd
commit f604f9e470
No known key found for this signature in database
GPG key ID: 022896A53AEF1381

View file

@ -33,8 +33,14 @@ def options(%URI{} = uri, opts \\ []) do
end end
defp pool_timeout(opts) do defp pool_timeout(opts) do
timeout = {config_key, default} =
Config.get([:pools, opts[:pool], :timeout]) || Config.get([:pools, :default, :timeout]) if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun do
{:pools, Config.get([:pools, :default, :timeout])}
else
{:hackney_pools, 10_000}
end
timeout = Config.get([config_key, opts[:pool], :timeout], default)
Keyword.merge(opts, timeout: timeout) Keyword.merge(opts, timeout: timeout)
end end