From 21e395ec625681b99cdb909f38a9f58a99ed7511 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 1 Aug 2025 17:49:04 -0500 Subject: [PATCH] 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. --- lib/aprsme/cluster/leader_election.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/aprsme/cluster/leader_election.ex b/lib/aprsme/cluster/leader_election.ex index 2c48860..06c8855 100644 --- a/lib/aprsme/cluster/leader_election.ex +++ b/lib/aprsme/cluster/leader_election.ex @@ -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