diff --git a/config/runtime.exs b/config/runtime.exs index 7dcdaa0e..ce0f240d 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -254,8 +254,11 @@ if config_env() == :prod do # Sync device usage to Stripe daily at 3 AM UTC {"0 3 * * *", Towerops.Workers.BillingSyncWorker} ]}, - # Automatically delete completed jobs after 60 seconds - {Oban.Plugins.Pruner, max_age: 60}, + # Automatically delete completed jobs after 60 seconds. + # Default limit of 10k/30s (333/s) can't keep up with job throughput (~600+/s), + # causing oban_jobs to bloat to millions of rows and slow all queries. + # 50k/5s (10,000/s) keeps the table small. + {Oban.Plugins.Pruner, max_age: 60, limit: 50_000, interval: to_timeout(second: 5)}, # Rescue orphaned jobs (when node crashes) {Oban.Plugins.Reindexer, schedule: "0 2 * * *"}, # Rescue jobs stuck in executing state (mark as cancelled after 10 minutes)