Heroku cron job help
How do I run the task reklamer:runall every 15 minutes in cron.rake?
I have my cron.rake file:
desc "This task is called by the开发者_开发问答 Heroku cron add-on"
task :cron => :environment do
if Time.now.hour % 4 == 0 # run every four hours
puts "Updating feed..."
NewsFeed.update
puts "done."
end
Heroku only provides daily or hourly cron jobs so I think you're out of luck with running cron jobs every 15 minutes.
Instead, you could use delayed_job to run jobs every 15 minutes. At the end of each run, your job code should create another job which will run in 15 minutes. You could calculate 15 minutes from the start or the end of the job, depending on your needs.
精彩评论