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.
This commit is contained in:
Graham McIntire 2026-04-10 09:13:29 -05:00
parent 321300895e
commit 65e3159a85
7 changed files with 7 additions and 0 deletions

View file

@ -32,6 +32,7 @@ defmodule Mix.Tasks.Backtest do
@impl Mix.Task
def run(argv) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{opts, _, _} =
OptionParser.parse(argv,

View file

@ -27,6 +27,7 @@ defmodule Mix.Tasks.Era5Backfill do
@impl Mix.Task
def run(args) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
limit =
case args do

View file

@ -28,6 +28,7 @@ defmodule Mix.Tasks.HrrrBackfill do
@impl Mix.Task
def run(args) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{opts, _, _} = OptionParser.parse(args, switches: [all: :boolean, limit: :integer])
refetch_all? = Keyword.get(opts, :all, false)

View file

@ -17,6 +17,7 @@ defmodule Mix.Tasks.HrrrClimatology do
@impl Mix.Task
def run(argv) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{opts, _, _} = OptionParser.parse(argv, switches: [min_samples: :integer])
min_samples = Keyword.get(opts, :min_samples, 3)

View file

@ -26,6 +26,7 @@ defmodule Mix.Tasks.HrrrNativeBackfill do
@impl Mix.Task
def run(argv) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
limit = Keyword.get(opts, :limit, 50)

View file

@ -23,6 +23,7 @@ defmodule Mix.Tasks.HrrrNativeDeriveFields do
@impl Mix.Task
def run(argv) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
limit = Keyword.get(opts, :limit, 10_000)

View file

@ -21,6 +21,7 @@ defmodule Mix.Tasks.ResetEnrichment do
@impl Mix.Task
def run(_args) do
Mix.Task.run("app.start")
Oban.pause_all_queues(Oban)
{count, _} =
Contact