diff --git a/config/runtime.exs b/config/runtime.exs index c6473cbe..f2578331 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -383,12 +383,24 @@ if config_env() == :prod do # cluster-elected leader actually connects (`:global` registration # in `Microwaveprop.Pskr.Client`). Set `PSKR_MQTT_ENABLED=false` # to kill the entire feature without code change. + # + # Backfill pods opt out unconditionally — they share the libcluster + # `app=prop` selector with the hot pods, so without this gate the + # backfill pod can win :global election (FCFS during a rollout) + # and pin the MQTT client onto a node that's also under heavy + # batch-job load. MQTT is real-time; backfill is bursty CPU; the + # two don't mix on the same pod. + pskr_default = prop_role != "backfill" + case System.get_env("PSKR_MQTT_ENABLED") do disabled when disabled in ["0", "false", "FALSE"] -> config :microwaveprop, :pskr_mqtt_enabled, false - _ -> + enabled when enabled in ["1", "true", "TRUE"] -> config :microwaveprop, :pskr_mqtt_enabled, true + + _ -> + config :microwaveprop, :pskr_mqtt_enabled, pskr_default end # Optional secondary repo for read-only access to aprs.me's database.