This commit is contained in:
Alexander Strizhakov 2020-03-03 16:08:21 +03:00
parent e605e79df9
commit 7d68924e4f
No known key found for this signature in database
GPG key ID: 022896A53AEF1381

View file

@ -54,7 +54,7 @@ def open(%URI{} = uri, name, opts) do
if Connections.count(name) < opts[:max_connection] do
do_open(uri, opts)
else
try_do_open(name, uri, opts)
close_least_used_and_do_open(name, uri, opts)
end
if is_pid(conn_pid) do
@ -159,7 +159,7 @@ defp add_http2_opts(opts, "https", tls_opts) do
defp add_http2_opts(opts, _, _), do: opts
defp try_do_open(name, uri, opts) do
defp close_least_used_and_do_open(name, uri, opts) do
Logger.debug("try to open conn #{Connections.compose_uri_log(uri)}")
with [{close_key, least_used} | _conns] <-