diff --git a/config/config.exs b/config/config.exs index fc8e291b..cfe32727 100644 --- a/config/config.exs +++ b/config/config.exs @@ -43,6 +43,7 @@ config :microwaveprop, MicrowavepropWeb.Endpoint, live_view: [signing_salt: "Gdq36xze"] config :microwaveprop, Oban, + engine: Oban.Pro.Engines.Smart, repo: Microwaveprop.Repo, queues: [solar: 1, weather: 20, enqueue: 1, hrrr: 5, terrain: 4, commercial: 2, iemre: 10, propagation: 1], plugins: [ diff --git a/config/runtime.exs b/config/runtime.exs index da797fdf..8ba1734a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -129,8 +129,11 @@ if config_env() == :prod do ], secret_key_base: secret_key_base - # Production Oban: live scoring, polling, and on-demand QSO enrichment + # Production Oban: live scoring, polling, and on-demand QSO enrichment. + # Runs on the Oban Pro Smart engine so we can use global_limit / rate_limit + # to protect rate-limited upstreams (Copernicus CDS in particular). config :microwaveprop, Oban, + engine: Oban.Pro.Engines.Smart, # Per-pod concurrency (×3 pods = effective cluster total) queues: [ propagation: 1, @@ -141,7 +144,11 @@ if config_env() == :prod do terrain: 3, iemre: 3, era5: 2, - era5_batch: 2, + era5_batch: [ + local_limit: 2, + global_limit: 4, + rate_limit: [allowed: 10, period: {1, :hour}] + ], rtma: 2, backfill_enqueue: 1 ], diff --git a/priv/repo/migrations/20260409191733_add_oban_pro.exs b/priv/repo/migrations/20260409191733_add_oban_pro.exs new file mode 100644 index 00000000..4ceee61f --- /dev/null +++ b/priv/repo/migrations/20260409191733_add_oban_pro.exs @@ -0,0 +1,7 @@ +defmodule Microwaveprop.Repo.Migrations.AddObanPro do + use Ecto.Migration + + def up, do: Oban.Pro.Migration.up() + + def down, do: Oban.Pro.Migration.down() +end