diff options
author | Alex S <alex.strizhakov@gmail.com> | 2019-08-20 13:10:28 +0300 |
---|---|---|
committer | Alex S <alex.strizhakov@gmail.com> | 2019-08-20 13:10:28 +0300 |
commit | 70c4f003497ca6a324014c112a4276666e2e8ed0 (patch) | |
tree | 1d37e5e26cd557a1fa095e90f242b9e0379f86fd | |
parent | b8ee02579275b2c2fd7b511b357ae039b9c82fb7 (diff) | |
download | pleroma-70c4f003497ca6a324014c112a4276666e2e8ed0.tar.gz |
formatting and pool fix
-rw-r--r-- | lib/pleroma/gun/connections.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/http/http.ex | 5 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/pleroma/gun/connections.ex b/lib/pleroma/gun/connections.ex index d3c44017d..5b0605026 100644 --- a/lib/pleroma/gun/connections.ex +++ b/lib/pleroma/gun/connections.ex @@ -112,8 +112,8 @@ defmodule Pleroma.Gun.Connections do @impl true def handle_info({:gun_down, conn_pid, _protocol, _reason, _killed, _unprocessed}, state) do - conn_key = compose_key_gun_info(conn_pid) - {key, conn} = find_conn(state.conns, conn_pid, conn_key) + # we can't get info on this pid, because pid is dead + {key, conn} = find_conn(state.conns, conn_pid) Enum.each(conn.waiting_pids, fn waiting_pid -> GenServer.reply(waiting_pid, nil) end) @@ -128,6 +128,12 @@ defmodule Pleroma.Gun.Connections do "#{info.origin_scheme}:#{info.origin_host}:#{info.origin_port}" end + defp find_conn(conns, conn_pid) do + Enum.find(conns, fn {_key, conn} -> + conn.conn == conn_pid + end) + end + defp find_conn(conns, conn_pid, conn_key) do Enum.find(conns, fn {key, conn} -> key == conn_key and conn.conn == conn_pid diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http/http.ex index aca378c9d..b18ce2803 100644 --- a/lib/pleroma/http/http.ex +++ b/lib/pleroma/http/http.ex @@ -91,8 +91,9 @@ defmodule Pleroma.HTTP do "https" -> adapter_opts = Keyword.get(options, :adapter, []) - tls_opts = Keyword.get(adapter_opts, :tls_opts, []) - |> Keyword.put(:server_name_indication, host) + tls_opts = + Keyword.get(adapter_opts, :tls_opts, []) + |> Keyword.put(:server_name_indication, host) adapter_opts = Keyword.put(adapter_opts, :tls_opts, tls_opts) diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index f20cd2840..1515f4eb6 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -555,7 +555,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do note_two = insert(:note, data: %{"context" => "suya.."}) activity_two = insert(:note_activity, note: note_two) - {:ok, activity_two} = CommonAPI.add_mute(user, activity_two) + {:ok, _activity_two} = CommonAPI.add_mute(user, activity_two) assert [_activity_two, _activity_one] = ActivityPub.fetch_activities([], %{"muting_user" => user, "with_muted" => true}) |