From 73448d7811a23353ccf917f9e4423f5fc08c52cc Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 9 Feb 2026 11:49:51 -0600 Subject: [PATCH] Fix remaining warning and design suggestion - Fix length/1 check in mobile_channel.ex - Add LeaderElection alias in connection_manager.ex All warnings and design suggestions now complete! Remaining: 40 refactoring opportunities (complex/nested functions) --- lib/aprsme/cluster/connection_manager.ex | 3 ++- lib/aprsme_web/channels/mobile_channel.ex | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/aprsme/cluster/connection_manager.ex b/lib/aprsme/cluster/connection_manager.ex index b53300d..a3fcb20 100644 --- a/lib/aprsme/cluster/connection_manager.ex +++ b/lib/aprsme/cluster/connection_manager.ex @@ -5,6 +5,7 @@ defmodule Aprsme.Cluster.ConnectionManager do """ use GenServer + alias Aprsme.Cluster.LeaderElection alias Aprsme.Is.IsSupervisor require Logger @@ -26,7 +27,7 @@ defmodule Aprsme.Cluster.ConnectionManager do @impl true def handle_info(:check_initial_state, state) do - if Aprsme.Cluster.LeaderElection.leader?() do + if LeaderElection.leader?() do Logger.info("This node is the leader, starting APRS-IS connection") start_aprs_connection() {:noreply, %{state | connection_started: true}} diff --git a/lib/aprsme_web/channels/mobile_channel.ex b/lib/aprsme_web/channels/mobile_channel.ex index 74a971b..de1c74d 100644 --- a/lib/aprsme_web/channels/mobile_channel.ex +++ b/lib/aprsme_web/channels/mobile_channel.ex @@ -370,7 +370,7 @@ defmodule AprsmeWeb.MobileChannel do Logger.info("Loaded #{length(packets)} historical packets for mobile client") # Send historical packets to client - if length(packets) > 0 do + if packets != [] do # Convert packets to mobile format and send them Enum.each(packets, fn packet -> packet_data = build_mobile_packet(packet)