I am using Ruby on Rails 5.2.0 to develop a system and I need to run a job every 2 minute.
I'm using sidekiq
for background processing and sidekiq-cron
for scheduling jobs.
I execute the following line in rails console:
job=Sidekiq::Cron::Job.new( name: 'TestWorker_Job', cron: '*/2 * * * *', klass: 'PriceWorker')
And this is the answer
=> #<Sidekiq::Cron::Job:0x000055b6d54707e8
@active_job=false,
@active_job_queue_name_delimiter=nil,
@active_job_queue_name_prefix=nil,
@args=[],
@cron="*/2 * * * *",
@fetch_missing_args=true,
@klass="PriceWorker",
@last_enqueue_time=nil,
@message={"retry"=>false, "queue"=>"default", "class"=>"PriceWorker", "args"=>[]},
@name="TestWorker_Job",
@queue="default",
@queue_name_with_prefix="default",
@status="enabled">
But it throws me an error:
job.errors
=> ["'cron' -> */2 * * * *: uninitialized constant Rufus::Scheduler::CronLine"]
There is no valid job. I don't know what i am doing wrong. Sidekiq-cron github page do the same thing.