more info in Connections.checkin timout errors

This commit is contained in:
Alexander Strizhakov 2020-02-21 12:53:40 +03:00
parent a03c420b84
commit ad8f26c0a4
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
5 changed files with 23 additions and 14 deletions

View File

@ -115,11 +115,16 @@ defp try_to_get_conn(uri, opts) do
opts opts
catch catch
:exit, {:timeout, _} -> :exit, {:timeout, {_, operation, [_, {method, _}, _]}} ->
messages_len =
:gun_connections
|> Process.whereis()
|> Process.info(:message_queue_len)
Logger.warn( Logger.warn(
"Gun connections pool checkin with timeout error #{uri.scheme}://#{ "Gun connections pool checkin with timeout error for #{operation} #{method} #{
Connections.compose_uri(uri) uri.scheme
}" }://#{Connections.compose_uri(uri)}. Messages length: #{messages_len}"
) )
opts opts

View File

@ -61,8 +61,8 @@ test "returns successfully result" do
describe "connection pools" do describe "connection pools" do
@describetag :integration @describetag :integration
clear_config([Pleroma.Gun.API]) do clear_config(Pleroma.Gun.API) do
Pleroma.Config.put([Pleroma.Gun.API], Pleroma.Gun) Pleroma.Config.put(Pleroma.Gun.API, Pleroma.Gun)
end end
test "gun" do test "gun" do

View File

@ -15,6 +15,10 @@ defmodule Pleroma.Pool.ConnectionsTest do
:ok :ok
end end
clear_config([:connections_pool, :retry]) do
Pleroma.Config.put([:connections_pool, :retry], 5)
end
setup do setup do
name = :test_connections name = :test_connections
adapter = Application.get_env(:tesla, :adapter) adapter = Application.get_env(:tesla, :adapter)
@ -429,8 +433,8 @@ test "remove frequently used and idle", %{name: name} do
describe "integration test" do describe "integration test" do
@describetag :integration @describetag :integration
clear_config([API]) do clear_config(API) do
Pleroma.Config.put([API], Pleroma.Gun) Pleroma.Config.put(API, Pleroma.Gun)
end end
test "opens connection and reuse it on next request", %{name: name} do test "opens connection and reuse it on next request", %{name: name} do

View File

@ -8,8 +8,8 @@ defmodule Pleroma.ReverseProxy.Client.TeslaTest do
alias Pleroma.ReverseProxy.Client alias Pleroma.ReverseProxy.Client
@moduletag :integration @moduletag :integration
clear_config_all([Pleroma.Gun.API]) do clear_config_all(Pleroma.Gun.API) do
Pleroma.Config.put([Pleroma.Gun.API], Pleroma.Gun) Pleroma.Config.put(Pleroma.Gun.API, Pleroma.Gun)
end end
setup do setup do

View File

@ -345,12 +345,12 @@ test "with content-disposition header", %{conn: conn} do
describe "tesla client using gun integration" do describe "tesla client using gun integration" do
@describetag :integration @describetag :integration
clear_config([Pleroma.ReverseProxy.Client]) do clear_config(Pleroma.ReverseProxy.Client) do
Pleroma.Config.put([Pleroma.ReverseProxy.Client], Pleroma.ReverseProxy.Client.Tesla) Pleroma.Config.put(Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.Client.Tesla)
end end
clear_config([Pleroma.Gun.API]) do clear_config(Pleroma.Gun.API) do
Pleroma.Config.put([Pleroma.Gun.API], Pleroma.Gun) Pleroma.Config.put(Pleroma.Gun.API, Pleroma.Gun)
end end
setup do setup do