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)
This commit is contained in:
parent
185266a1f9
commit
73448d7811
2 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ defmodule Aprsme.Cluster.ConnectionManager do
|
||||||
"""
|
"""
|
||||||
use GenServer
|
use GenServer
|
||||||
|
|
||||||
|
alias Aprsme.Cluster.LeaderElection
|
||||||
alias Aprsme.Is.IsSupervisor
|
alias Aprsme.Is.IsSupervisor
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
@ -26,7 +27,7 @@ defmodule Aprsme.Cluster.ConnectionManager do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_info(:check_initial_state, state) do
|
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")
|
Logger.info("This node is the leader, starting APRS-IS connection")
|
||||||
start_aprs_connection()
|
start_aprs_connection()
|
||||||
{:noreply, %{state | connection_started: true}}
|
{:noreply, %{state | connection_started: true}}
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ defmodule AprsmeWeb.MobileChannel do
|
||||||
Logger.info("Loaded #{length(packets)} historical packets for mobile client")
|
Logger.info("Loaded #{length(packets)} historical packets for mobile client")
|
||||||
|
|
||||||
# Send historical packets to client
|
# Send historical packets to client
|
||||||
if length(packets) > 0 do
|
if packets != [] do
|
||||||
# Convert packets to mobile format and send them
|
# Convert packets to mobile format and send them
|
||||||
Enum.each(packets, fn packet ->
|
Enum.each(packets, fn packet ->
|
||||||
packet_data = build_mobile_packet(packet)
|
packet_data = build_mobile_packet(packet)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue