I am using Resque with Redis to handle a background job. I would like to call the Resque.enqueue (MyModel) method only once per hour to do the background job.
For example: Let's say I have a website with 10,000 users. I would call this method 24 times a day; not 10,000 * 24. Example method below:
Resque.enqueue(MyModel)
Thank you for your help. It should also be mentioned that I prefer to stick with Resque and not switch to the Delayed Job. Thank.
You must use the cron job for this task.
I suggest you use the Whenever gem.
railscast : http://railscasts.com/episodes/164-cron-in-ruby
Resque, Resque: resque-scheduler. Resque . , README. DelayedJob ( ).
whenever resque-scheduler:
whenever
resque-scheduler
resque-loner
Whenever, , , , .
:
every 3.hours do runner "MyModel.some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end
, :
$ gem install whenever
GemFile:
gem 'whenever', :require => false
$ cd /apps/my-great-project $ wheneverize .
, !