Hello everyone, I’m having a problem with Oban and would like to know if anyone has any ideas on how to solve it.
I have 3 instances (local, development, and production) and the only environment that isn’t working is in production, all of them with the same config.
Testing with StartFetchEmails.new(%{}) |> Oban.insert!()
, it works as expected. Other Workers are also processed normally Only the cron part doesn’t seem to be working.
Oban configuration
[
{Oban.Pro.Plugins.DynamicCron,
crontab:
[
{"@hourly", ProcessPropertyViewCountWorker, args: %{interval: "1h"}},
# Run every day
{"@daily", ExpireShortUrl},
# Run every hour
{"@hourly", StartFetchEmails},
# Run every hour
{"@hourly", StartDealEmails},
# Run every day at 5:00 PM (CST)
{"0 23 * * *", SendPushNotification, args: %{type: "upcoming_appointment"}},
# Run every 2 hours
{"0 */2 * * *", SendPushNotification, args: %{type: "pending_appointment"}},
# Run every 10 minutes
{"*/10 * * * *", SendPushNotification,
args: %{type: "start_appointment_reminder"}}
]}
]
More context:
I have all those crontab set to run, however some of them are running some not.
working:
- ProcessPropertyViewCountWorker
- ExpireShortUrl
- SendPushNotification args: %{type: “start_appointment_reminder”}
Not working:
- StartFetchEmails
- StartDealEmails
- SendPushNotification (different type)
I also created this test module
use Oban.Worker,
queue: :ai_deal_emails,
max_attempts: 5
@impl Oban.Worker
def perform(_args) do
dbg("hello!!!")
:ok
end
end
and inserted using remote:
Oban.Pro.Plugins.DynamicCron.insert([{"* * * * *", Core.Workers.TestOban}])
Once again, local/dev works, prod doesn’t.
select * from oban_crons oc;
My database have this entries but even after change from “* * * * *” to “@hourly”, the database keeps the old configuration (which makes me suspect that maybe some migration broke the oban part)
Oban.Pro.Plugins.DynamicCron.all()
[
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.ProcessPropertyViewCountWorker",
expression: "@hourly",
worker: "Core.Workers.ProcessPropertyViewCountWorker",
opts: %{"args" => %{"interval" => "1h"}},
paused: false,
insertions: [~U[2025-05-06 18:00:00.080982Z],
~U[2025-05-06 17:00:00.806662Z], ~U[2025-05-06 16:00:00.498883Z],
~U[2025-05-06 15:00:00.186364Z], ~U[2025-05-06 14:00:00.760659Z],
~U[2025-05-06 13:00:00.474475Z], ~U[2025-05-06 12:00:00.085761Z],
~U[2025-05-06 11:00:00.694607Z], ~U[2025-05-06 10:00:00.439473Z],
~U[2025-05-06 09:00:00.982642Z], ~U[2025-05-06 08:00:00.768375Z],
~U[2025-05-06 07:00:00.535584Z], ~U[2025-05-06 06:00:00.319683Z],
~U[2025-05-06 05:00:00.093724Z], ~U[2025-05-06 04:00:00.885761Z],
~U[2025-05-06 03:00:00.671577Z], ~U[2025-05-06 02:00:00.433340Z],
~U[2025-05-06 01:00:00.224410Z], ~U[2025-05-06 00:00:00.976516Z],
~U[2025-05-05 23:00:00.753005Z], ~U[2025-05-05 22:00:00.520786Z],
~U[2025-05-05 21:00:00.304766Z], ~U[2025-05-05 20:00:00.081683Z],
~U[2025-05-05 19:00:00.868639Z], ~U[2025-05-05 18:00:00.644642Z],
~U[2025-05-05 17:00:00.419561Z], ~U[2025-05-05 16:00:00.193703Z],
~U[2025-05-05 15:00:00.972605Z], ~U[2025-05-05 14:00:00.736932Z],
~U[2025-05-05 13:00:00.517995Z], ~U[2025-05-05 12:00:00.302269Z],
~U[2025-05-05 11:00:00.092656Z], ~U[2025-05-05 10:00:00.877941Z],
~U[2025-05-05 09:00:00.652727Z], ~U[2025-05-05 08:00:00.431607Z],
~U[2025-05-05 07:00:00.203757Z], ~U[2025-05-05 06:00:00.964735Z],
~U[2025-05-05 05:00:00.758469Z], ~U[2025-05-05 04:00:00.536440Z],
~U[2025-05-05 03:00:00.323295Z], ~U[2025-05-05 02:00:00.101257Z],
~U[2025-05-05 01:00:00.859765Z], ...],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2024-04-16 00:34:00.051817Z],
updated_at: ~U[2024-04-16 00:34:00.051817Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.ExpireShortUrl",
expression: "@daily",
worker: "Core.Workers.ExpireShortUrl",
opts: %{},
paused: false,
insertions: [~U[2025-05-06 00:00:00.976516Z],
~U[2025-05-05 00:00:00.626842Z], ~U[2025-05-04 00:00:00.299802Z],
~U[2025-05-03 00:00:00.847825Z], ~U[2025-05-02 00:00:00.466631Z],
~U[2025-05-01 00:00:00.200450Z], ~U[2025-04-30 00:00:00.941552Z],
~U[2025-04-29 00:00:00.757624Z], ~U[2025-04-28 00:00:00.473270Z],
~U[2025-04-27 00:00:00.293409Z], ~U[2025-04-26 00:00:00.108633Z],
~U[2025-04-25 00:00:00.836502Z], ~U[2025-04-24 00:00:00.518333Z],
~U[2025-04-23 00:00:00.194706Z], ~U[2025-04-22 00:00:00.946726Z],
~U[2025-04-21 00:00:00.654658Z], ~U[2025-04-20 00:00:00.462662Z],
~U[2025-04-19 00:00:00.248750Z], ~U[2025-04-18 00:00:00.928512Z],
~U[2025-04-17 00:00:00.766231Z], ~U[2025-04-16 00:00:00.468690Z],
~U[2025-04-15 00:00:00.207210Z], ~U[2025-04-14 00:00:00.021697Z],
~U[2025-04-13 00:00:00.789648Z], ~U[2025-04-12 00:00:00.430723Z],
~U[2025-04-11 00:00:00.069960Z], ~U[2025-04-10 00:00:00.696818Z],
~U[2025-04-09 00:00:00.386730Z], ~U[2025-04-08 00:00:00.086157Z],
~U[2025-04-07 00:00:00.734564Z], ~U[2025-04-06 00:00:00.483860Z],
~U[2025-04-05 00:00:00.259577Z], ~U[2025-04-04 00:00:00.053186Z],
~U[2025-04-03 00:00:00.778720Z], ~U[2025-04-02 00:00:00.566785Z],
~U[2025-04-01 00:00:00.435587Z], ~U[2025-03-31 00:00:00.302744Z],
~U[2025-03-30 00:00:00.157767Z], ~U[2025-03-29 00:00:00.946562Z],
~U[2025-03-28 00:00:00.722721Z], ~U[2025-03-27 00:00:00.508481Z], ...],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2024-04-16 00:34:00.053784Z],
updated_at: ~U[2024-04-16 00:34:00.053784Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.SendPushNotification",
expression: "*/10 * * * *",
worker: "Core.Workers.SendPushNotification",
opts: %{"args" => %{"type" => "start_appointment_reminder"}},
paused: false,
insertions: [~U[2025-05-06 18:00:00.080982Z],
~U[2025-05-06 17:50:00.043367Z], ~U[2025-05-06 17:40:00.988646Z],
~U[2025-05-06 17:30:00.952671Z], ~U[2025-05-06 17:20:00.917375Z],
~U[2025-05-06 17:10:00.857095Z], ~U[2025-05-06 17:00:00.806662Z],
~U[2025-05-06 16:50:00.763756Z], ~U[2025-05-06 16:40:00.718475Z],
~U[2025-05-06 16:30:00.654733Z], ~U[2025-05-06 16:20:00.610730Z],
~U[2025-05-06 16:10:00.566119Z], ~U[2025-05-06 16:00:00.498883Z],
~U[2025-05-06 15:50:00.445666Z], ~U[2025-05-06 15:40:00.372718Z],
~U[2025-05-06 15:30:00.329738Z], ~U[2025-05-06 15:20:00.277441Z],
~U[2025-05-06 15:10:00.229815Z], ~U[2025-05-06 15:00:00.186364Z],
~U[2025-05-06 14:50:00.108736Z], ~U[2025-05-06 14:40:00.015686Z],
~U[2025-05-06 14:30:00.955922Z], ~U[2025-05-06 14:20:00.866428Z],
~U[2025-05-06 14:10:00.821735Z], ~U[2025-05-06 14:00:00.760659Z],
~U[2025-05-06 13:50:00.717626Z], ~U[2025-05-06 13:40:00.675541Z],
~U[2025-05-06 13:30:00.621246Z], ~U[2025-05-06 13:20:00.560342Z],
~U[2025-05-06 13:10:00.509899Z], ~U[2025-05-06 13:00:00.474475Z],
~U[2025-05-06 12:50:00.439485Z], ~U[2025-05-06 12:40:00.371458Z],
~U[2025-05-06 12:30:00.290444Z], ~U[2025-05-06 12:20:00.233709Z],
~U[2025-05-06 12:10:00.146050Z], ~U[2025-05-06 12:00:00.085761Z],
~U[2025-05-06 11:50:00.035393Z], ~U[2025-05-06 11:40:00.972413Z],
~U[2025-05-06 11:30:00.889717Z], ...],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2024-07-30 03:18:00.943992Z],
updated_at: ~U[2024-07-30 03:18:00.943992Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.RemoveOldTriedSkipTraces",
expression: "@daily",
worker: "Core.Workers.RemoveOldTriedSkipTraces",
opts: %{},
paused: false,
insertions: [~U[2025-05-06 00:00:00.976516Z],
~U[2025-05-05 00:00:00.626842Z], ~U[2025-05-04 00:00:00.299802Z],
~U[2025-05-03 00:00:00.847825Z], ~U[2025-05-02 00:00:00.466631Z],
~U[2025-05-01 00:00:00.200450Z], ~U[2025-04-30 00:00:00.941552Z],
~U[2025-04-29 00:00:00.757624Z], ~U[2025-04-28 00:00:00.473270Z],
~U[2025-04-27 00:00:00.293409Z], ~U[2025-04-26 00:00:00.108633Z],
~U[2025-04-25 00:00:00.836502Z], ~U[2025-04-24 00:00:00.518333Z],
~U[2025-04-23 00:00:00.194706Z], ~U[2025-04-22 00:00:00.946726Z],
~U[2025-04-21 00:00:00.654658Z], ~U[2025-04-20 00:00:00.462662Z],
~U[2025-04-19 00:00:00.248750Z], ~U[2025-04-18 00:00:00.928512Z],
~U[2025-04-17 00:00:00.766231Z], ~U[2025-04-16 00:00:00.468690Z],
~U[2025-04-15 00:00:00.207210Z], ~U[2025-04-14 00:00:00.021697Z],
~U[2025-04-13 00:00:00.789648Z], ~U[2025-04-12 00:00:00.430723Z],
~U[2025-04-11 00:00:00.069960Z], ~U[2025-04-10 00:00:00.696818Z],
~U[2025-04-09 00:00:00.386730Z], ~U[2025-04-08 00:00:00.086157Z],
~U[2025-04-07 00:00:00.734564Z], ~U[2025-04-06 00:00:00.483860Z],
~U[2025-04-05 00:00:00.259577Z], ~U[2025-04-04 00:00:00.053186Z],
~U[2025-04-03 00:00:00.778720Z], ~U[2025-04-02 00:00:00.566785Z],
~U[2025-04-01 00:00:00.435587Z], ~U[2025-03-31 00:00:00.302744Z],
~U[2025-03-30 00:00:00.157767Z], ~U[2025-03-29 00:00:00.946562Z], ...],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2024-12-11 21:25:00.881745Z],
updated_at: ~U[2024-12-11 21:25:00.881745Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.SkipTraceRankedEntities",
expression: "@hourly",
worker: "Core.Workers.SkipTraceRankedEntities",
opts: %{},
paused: false,
insertions: [~U[2025-03-13 03:00:00.939803Z],
~U[2025-03-13 02:00:00.516874Z], ~U[2025-03-13 01:00:00.155841Z],
~U[2025-03-13 00:00:00.784568Z], ~U[2025-03-12 23:00:00.321591Z],
~U[2025-03-12 22:00:00.977622Z], ~U[2025-03-12 21:00:00.635865Z],
~U[2025-03-12 20:00:00.030182Z], ~U[2025-03-12 19:00:00.532528Z],
~U[2025-03-12 18:00:00.120850Z], ~U[2025-03-12 17:00:00.657106Z],
~U[2025-03-11 12:00:00.391899Z], ~U[2025-03-11 11:00:00.076079Z],
~U[2025-03-11 10:00:00.784117Z], ~U[2025-03-11 09:00:00.498012Z],
~U[2025-03-11 08:00:00.117002Z], ~U[2025-03-11 07:00:00.735609Z],
~U[2025-03-11 06:00:00.372843Z], ~U[2025-03-11 05:00:00.024419Z],
~U[2025-03-11 04:00:00.634756Z], ~U[2025-03-11 03:00:00.247831Z],
~U[2025-03-11 02:00:00.929518Z], ~U[2025-03-11 01:00:00.533949Z],
~U[2025-03-11 00:00:00.177873Z], ~U[2025-03-10 23:00:00.804791Z],
~U[2025-03-10 22:00:00.198844Z], ~U[2025-03-10 01:00:00.444967Z],
~U[2025-03-10 00:00:00.940568Z]],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2025-03-09 23:03:00.224636Z],
updated_at: ~U[2025-03-09 23:03:00.224636Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.StartFetchEmails",
expression: "* * * * *",
worker: "Core.Workers.StartFetchEmails",
opts: %{},
paused: false,
insertions: [],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2025-05-06 13:59:36.669064Z],
updated_at: ~U[2025-05-06 13:59:36.669064Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.StartDealEmails",
expression: "* * * * *",
worker: "Core.Workers.StartDealEmails",
opts: %{},
paused: false,
insertions: [],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2025-05-06 13:59:36.687079Z],
updated_at: ~U[2025-05-06 13:59:36.687079Z]
},
%Oban.Pro.Cron{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_crons">,
name: "Core.Workers.TestOban",
expression: "* * * * *",
worker: "Core.Workers.TestOban",
opts: %{},
paused: false,
insertions: [],
lock_version: 2,
parsed: nil,
inserted_at: ~U[2025-05-06 14:13:17.067649Z],
updated_at: ~U[2025-05-06 14:13:17.067649Z]
}
]