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
|
@impl Mix.Task
|
||||||
def run(argv) do
|
def run(argv) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{opts, _, _} =
|
{opts, _, _} =
|
||||||
OptionParser.parse(argv,
|
OptionParser.parse(argv,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ defmodule Mix.Tasks.Era5Backfill do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(args) do
|
def run(args) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
limit =
|
limit =
|
||||||
case args do
|
case args do
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ defmodule Mix.Tasks.HrrrBackfill do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(args) do
|
def run(args) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{opts, _, _} = OptionParser.parse(args, switches: [all: :boolean, limit: :integer])
|
{opts, _, _} = OptionParser.parse(args, switches: [all: :boolean, limit: :integer])
|
||||||
refetch_all? = Keyword.get(opts, :all, false)
|
refetch_all? = Keyword.get(opts, :all, false)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ defmodule Mix.Tasks.HrrrClimatology do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(argv) do
|
def run(argv) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{opts, _, _} = OptionParser.parse(argv, switches: [min_samples: :integer])
|
{opts, _, _} = OptionParser.parse(argv, switches: [min_samples: :integer])
|
||||||
min_samples = Keyword.get(opts, :min_samples, 3)
|
min_samples = Keyword.get(opts, :min_samples, 3)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ defmodule Mix.Tasks.HrrrNativeBackfill do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(argv) do
|
def run(argv) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
|
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
|
||||||
limit = Keyword.get(opts, :limit, 50)
|
limit = Keyword.get(opts, :limit, 50)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ defmodule Mix.Tasks.HrrrNativeDeriveFields do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(argv) do
|
def run(argv) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
|
{opts, _, _} = OptionParser.parse(argv, switches: [limit: :integer])
|
||||||
limit = Keyword.get(opts, :limit, 10_000)
|
limit = Keyword.get(opts, :limit, 10_000)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ defmodule Mix.Tasks.ResetEnrichment do
|
||||||
@impl Mix.Task
|
@impl Mix.Task
|
||||||
def run(_args) do
|
def run(_args) do
|
||||||
Mix.Task.run("app.start")
|
Mix.Task.run("app.start")
|
||||||
|
Oban.pause_all_queues(Oban)
|
||||||
|
|
||||||
{count, _} =
|
{count, _} =
|
||||||
Contact
|
Contact
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue