fix: Group handle_info clauses together in LeaderElection

Fixes compilation warning by moving the catch-all handle_info/2 clause
to be immediately after the specific handle_info/2 clauses.

In Elixir, all function clauses with the same name and arity must be
grouped together for pattern matching to work correctly.

This resolves the 'mix compile --warnings-as-errors' failure.
This commit is contained in:
Graham McIntire 2025-08-01 17:49:04 -05:00
parent 6bfea84b88
commit 21e395ec62
No known key found for this signature in database

View file

@ -108,6 +108,12 @@ defmodule Aprsme.Cluster.LeaderElection do
{:noreply, state}
end
@impl true
def handle_info(msg, state) do
Logger.debug("LeaderElection received unexpected message: #{inspect(msg)}")
{:noreply, state}
end
@impl true
def handle_call(:is_leader?, _from, state) do
{:reply, state.is_leader, state}
@ -118,12 +124,6 @@ defmodule Aprsme.Cluster.LeaderElection do
{:reply, state.leader_node, state}
end
@impl true
def handle_info(msg, state) do
Logger.debug("LeaderElection received unexpected message: #{inspect(msg)}")
{:noreply, state}
end
@impl true
def terminate(reason, state) do
if state.is_leader do