diff --git a/lib/towerops_web/telemetry.ex b/lib/towerops_web/telemetry.ex index 3aeaa603..3ce60de7 100644 --- a/lib/towerops_web/telemetry.ex +++ b/lib/towerops_web/telemetry.ex @@ -135,12 +135,9 @@ defmodule ToweropsWeb.Telemetry do Publishes Exq queue and process statistics. """ def publish_exq_stats do - # Only run if Exq is available (not in test env) - if Application.get_env(:towerops, :env) == :test 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 :ok - # Get stats for each queue - - # Get process stats else try do queues = ["default", "discovery", "polling", "monitoring", "maintenance"] @@ -171,8 +168,9 @@ defmodule ToweropsWeb.Telemetry do ) :ok - rescue - _ -> :ok + catch + # Catch exits (like :noproc) and exceptions + _, _ -> :ok end end end