prop/lib/mix/tasks/reset_enrichment.ex
Graham McIntire 65e3159a85 Pause Oban queues in all mix tasks
Mix tasks that call app.start were also booting Oban's cron scheduler,
causing PropagationGridWorker and other cron jobs to fire during
backfills. Add Oban.pause_all_queues(Oban) immediately after app.start
in every mix task that only needs Repo access.
2026-04-10 09:13:30 -05:00

34 lines
990 B
Elixir

defmodule Mix.Tasks.ResetEnrichment do
@shortdoc "Reset weather/HRRR/IEMRE enrichment flags for re-processing"
@moduledoc """
Resets weather, HRRR, and IEMRE enrichment flags on all QSOs so the
next enqueue worker run re-processes them with multi-point path data.
Does NOT reset terrain_queued since terrain profiles are path-based (pos1→pos2)
and don't change with multi-point enrichment.
mix reset_enrichment
"""
use Mix.Task
import Ecto.Query
alias Microwaveprop.Radio.Contact
alias Microwaveprop.Repo
@impl Mix.Task
def run(_args) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{count, _} =
Contact
|> where([q], q.weather_status != :pending or q.hrrr_status != :pending or q.iemre_status != :pending)
|> Repo.update_all(set: [weather_status: "pending", hrrr_status: "pending", iemre_status: "pending"])
Mix.shell().info("Reset enrichment status to :pending on #{count} contacts")
:ok
end
end