Reputation: 471
I am using 'sidekiq' gem for background jobs. I wanted to add periodic (cron) job. I have add initializer names sidekiq.rb and the content of it is:
Sidekiq.configure_server do |config|
config.periodic do |mgr|
mgr.register('* * * * *', MessageLogJob)
end
end
and added a class in jobs folder:
class MessageLogJob < ActiveJob::Base
queue_as :default
def perform
# do some thing
end
end
when i restart the server and run command "bundle exec sidekiq" it gives me an error "undefined method `periodic' for Sidekiq:Module"
Can anyone help me in this regard. Thanks
Upvotes: 0
Views: 2040
Reputation: 1054
As mentioned in comments periodic
is part of Sidekiq Enterprise.
If you want to have cron-like jobs in Sidekiq, you can use one of multiple GEMs:
I am sure there are more plugins.
Upvotes: 2