Skip to content

Commit

Permalink
fix: add missing stop clause in DispatcherWorker init function (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlkxzmcp authored Nov 24, 2023
1 parent 358b5f9 commit d1305ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Resolve APNS `:too_many_provider_token_updates` by moving token generation into
`APNS.Token` ([#227](https://github.com/codedge-llc/pigeon/pull/227)).
- Support HTTPoison 2.0. ([#236](https://github.com/codedge-llc/pigeon/pull/236))
- Fix DispatcherWorker missing a clause for `{:stop, reason}` in the init function

## v2.0.0-rc.1

Expand Down
5 changes: 5 additions & 0 deletions lib/pigeon/dispatcher_worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule Pigeon.DispatcherWorker do
GenServer.start_link(__MODULE__, opts)
end

@impl GenServer
def init(opts) do
case opts[:adapter].init(opts) do
{:ok, state} ->
Expand All @@ -16,9 +17,13 @@ defmodule Pigeon.DispatcherWorker do

{:error, reason} ->
{:error, reason}

{:stop, reason} ->
{:stop, reason}
end
end

@impl GenServer
def handle_info({:"$push", notification}, %{adapter: adapter, state: state}) do
case adapter.handle_push(notification, state) do
{:noreply, new_state} ->
Expand Down

0 comments on commit d1305ec

Please sign in to comment.