From fc9d71334e7d3f962a2e7e75814b5a25cdc567e6 Mon Sep 17 00:00:00 2001 From: Claudio D'Alicandro Date: Fri, 24 Mar 2023 14:28:08 +0100 Subject: [PATCH] Avoid logging normal exits (#140) * chore: silently handle a :normal exit message * chore: bump version to 6.0.2 --- README.md | 2 +- lib/amqp/gen/consumer.ex | 2 ++ lib/amqp/gen/producer.ex | 2 ++ mix.exs | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf06e9c..9e340bb 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Written to prevent duplicated and boilerplate code to handle all the lifecycle o ```elixir def deps do [ - {:amqpx, "~> 6.0.1"} + {:amqpx, "~> 6.0.2"} ] end ``` diff --git a/lib/amqp/gen/consumer.ex b/lib/amqp/gen/consumer.ex index 3aaacb1..390861e 100644 --- a/lib/amqp/gen/consumer.ex +++ b/lib/amqp/gen/consumer.ex @@ -178,6 +178,8 @@ defmodule Amqpx.Gen.Consumer do {:stop, :channel_exited, state} end + def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state} + def handle_info(message, state) do Logger.warn("Unknown message received #{inspect(message)}") {:noreply, state} diff --git a/lib/amqp/gen/producer.ex b/lib/amqp/gen/producer.ex index d2227b9..2931e65 100644 --- a/lib/amqp/gen/producer.ex +++ b/lib/amqp/gen/producer.ex @@ -126,6 +126,8 @@ defmodule Amqpx.Gen.Producer do {:stop, :channel_exited, state} end + def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state} + def handle_info(message, state) do Logger.warn("Unknown message received #{inspect(message)}") {:noreply, state} diff --git a/mix.exs b/mix.exs index 4e9b551..bbc375e 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Amqpx.MixProject do [ app: :amqpx, name: "amqpx", - version: "6.0.1", + version: "6.0.2", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :production,