Skip to content

Commit

Permalink
reduce logger noise
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciogoldchluk-yolo committed Aug 8, 2024
1 parent 3175c3d commit 3507b9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/coney/connection_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ defmodule Coney.ConnectionServer do

@impl GenServer
def terminate(_reason, %State{amqp_conn: conn, adapter: adapter, channels: channels} = _state) do
Logger.info("[Coney] - Terminating #{inspect(conn)}")
close_channels(channels, adapter)
:ok = adapter.close(conn)
ConnectionRegistry.terminated(self())
Expand Down Expand Up @@ -162,18 +163,19 @@ defmodule Coney.ConnectionServer do
new_channel = adapter.create_channel(conn)
adapter.subscribe(new_channel, consumer_pid, consumer)

Logger.info("[Coney] - Connection re-restablished for #{inspect(consumer)}")

{channel_ref, {consumer_pid, consumer, new_channel}}
end)

Logger.info("[Coney] - Connection re-restablished for #{inspect(conn)}")

%State{state | channels: new_channels}
end

defp close_channels(channels, adapter) do
Enum.each(channels, fn {_channel_ref, {consumer_pid, consumer, channel}} ->
Logger.info("[Coney] - Closing channel for #{inspect(consumer)} (#{inspect(consumer_pid)})")
Enum.each(channels, fn {_channel_ref, {_consumer_pid, _consumer, channel}} ->
adapter.close_channel(channel)
end)

Logger.info("[Coney] - Closed #{map_size(channels)} channels")
end
end

0 comments on commit 3507b9b

Please sign in to comment.