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.
This commit is contained in:
parent
bac286ee1b
commit
a6a2c1cbde
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue