Reputation: 2999
I have a worker with one perform class. In the controller I am calling up that worker class. When I call it up with worker.perform.now
I see in console that perform method is being executed as I want it.
How to schedule this callup in controller, to be performed every day at ten o'clock?
PS: When I call worker.perform_async
it doesn't do anything.
Upvotes: 2
Views: 4088
Reputation: 2745
PS: When I call worker.perform_async it doesn't do anything.
I guess, that you didn't start sidekiq server. Type sidekiq
in console to start the server.
As it goes for scheduling sidekiq jobs to perform every period of time, there are several ways to do it.
The one recomended by the Sidekiq's author is to use CRON
with Whenever gem. He even provide and example here: https://github.com/mperham/sidekiq/blob/master/examples/scheduling.rb
Other way is to use Sidekiq-cron gem. I've found it easier to setup, but it emulates CRON
, that's why the first solution is more solid.
Upvotes: 2