0

Basically... I just want to exactly move what is in scheduler.rake into a worker because I am hoping it is faster and more reliable.

What is the quickest way to do this? I am on Rails 3

Nothing fancy. Just quick.

slindsey3000
  • 4,053
  • 5
  • 36
  • 56

2 Answers2

0

I would recommend using the whenever gem

in your Gemfile.

gem 'whenever', :require => false

This will create an initial config/schedule.rb file for you.

every 3.hours do
  # call background job
end

every 1.day, :at => '4:30 am' do
  # call background job
end

every :hour do 
  # call background job
end

every :sunday, :at => '12pm' do 
  # call background job
end

every '0 0 27-31 * *' do
  # call background job
end

I hope that this helps. Happy Hacking

MZaragoza
  • 10,108
  • 9
  • 71
  • 116
0

If you are using Heroku Scheduler then you can configure what type of dyno starts for each job.

Note that jobs ran on Scheduler should complete before next scheduled task or they will be terminated.

For more advanced clock related work please see this (but it's not trivial): https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes

Zepplock
  • 28,655
  • 4
  • 35
  • 50