From a6a2c1cbde13b8c7cf1ee553226491f8e1744bd1 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 18 Jan 2026 11:14:15 -0600 Subject: [PATCH] fix(telemetry): use is_nil instead of not for Process.whereis check The `not` operator in Elixir only works with booleans, not nil values. When Exq process doesn't exist, Process.whereis(Exq) returns nil, causing `:badarg` error when used with `not`. Error: Class=:error Reason=:badarg {:erlang, :not, [nil], [error_info: %{module: :erl_erts_errors}]} Changed from: not Process.whereis(Exq) To: is_nil(Process.whereis(Exq)) This properly checks if the process exists without causing runtime errors. --- lib/towerops_web/telemetry.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/towerops_web/telemetry.ex b/lib/towerops_web/telemetry.ex index 3ce60de7..bc8eb05a 100644 --- a/lib/towerops_web/telemetry.ex +++ b/lib/towerops_web/telemetry.ex @@ -136,7 +136,7 @@ defmodule ToweropsWeb.Telemetry do """ def publish_exq_stats do # Only run if Exq is available (not in test env) and the process is running - if Application.get_env(:towerops, :env) == :test or not Process.whereis(Exq) do + if Application.get_env(:towerops, :env) == :test or is_nil(Process.whereis(Exq)) do :ok else try do