Hi, it is my config to start my oban
every minute like this:
def start_oban_in_runtime() do
opts =
[
repo: MishkaInstaller.repo,
queues: [compile_events: [limit: 1]],
plugins: [
Oban.Plugins.Pruner,
{Oban.Plugins.Cron,
crontab: [
{"* * * * *", MishkaInstaller.DepUpdateJob}
]
}
]
]
DynamicSupervisor.start_child(MishkaInstaller.RunTimeObanSupervisor, {Oban, opts})
end
and the module:
defmodule MishkaInstaller.DepUpdateJob do
use Oban.Worker
require Logger
@spec perform(Oban.Job.t()) :: :ok
def perform(_) do
IO.inspect("test cron")
Logger.warn("This is the test of you DepUpdateJob")
:ok
end
end
it works for a normal job queue, but for cron
I can not run it
Thank you in advance
My application:
defmodule MishkaInstaller.Application do
use Application
@impl true
def start(_type, _args) do
children = [
..
{DynamicSupervisor, [ strategy: :one_for_one, name: PluginStateOtpRunner]},
{DynamicSupervisor, [strategy: :one_for_one, name: MishkaInstaller.RunTimeObanSupervisor]},
..
]
opts = [strategy: :one_for_one, name: MishkaInstaller.Supervisor]
Supervisor.start_link(children, opts)
end
end
I have read this post, but I could not fix my problem
extra data:
%Oban.Config{
dispatch_cooldown: 5,
engine: Oban.Queue.BasicEngine,
get_dynamic_repo: nil,
log: false,
name: Oban,
node: "shahryars-iMac",
notifier: Oban.Notifiers.Postgres,
peer: Oban.Peers.Postgres,
plugins: [
{Oban.Plugins.Cron,
[crontab: [{"* * * * *", MishkaInstaller.DepUpdateJob}]]},
Oban.Plugins.Pruner,
Oban.Plugins.Stager
],
prefix: "public",
queues: [compile_events: [limit: 1]],
repo: Repo,
shutdown_grace_period: 15000,
testing: :disabled
}