diff --git a/CHANGELOG.md b/CHANGELOG.md index 06ad3be..a39bdf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Changed** - Bump `goth` dependency to `~> 1.4.3`. ([#252](https://github.com/codedge-llc/pigeon/pull/252)) +- Fix `DispatcherWorker` missing a clause for `{:stop, reason}` in the handle_info function. ## v2.0.0-rc.2 diff --git a/lib/pigeon/adapter.ex b/lib/pigeon/adapter.ex index b54b574..20c53a5 100644 --- a/lib/pigeon/adapter.ex +++ b/lib/pigeon/adapter.ex @@ -45,15 +45,16 @@ defmodule Pigeon.Adapter do """ @callback init(opts :: Keyword.t()) :: {:ok, any} | {:stop, any} - @doc """ - Invoked to handle all other messages. - """ - @callback handle_info(term, term) :: {:noreply, term} - @doc """ Invoked to handle push notifications. """ @callback handle_push(notification :: struct | [struct], state :: term) :: {:noreply, new_state :: term} | {:stop, reason :: term, new_state :: term} + + @doc """ + Invoked to handle all other messages. + """ + @callback handle_info(term, term) :: + {:noreply, term} | {:stop, reason :: term} end diff --git a/lib/pigeon/dispatcher_worker.ex b/lib/pigeon/dispatcher_worker.ex index 935d0c8..9aa5c79 100644 --- a/lib/pigeon/dispatcher_worker.ex +++ b/lib/pigeon/dispatcher_worker.ex @@ -39,6 +39,9 @@ defmodule Pigeon.DispatcherWorker do {:noreply, new_state} -> {:noreply, %{adapter: adapter, state: new_state}} + {:stop, reason} -> + {:stop, reason, %{adapter: adapter, state: state}} + {:stop, reason, new_state} -> {:stop, reason, %{adapter: adapter, state: new_state}} end