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:
parent
321300895e
commit
65e3159a85
7 changed files with 7 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue