开发者

Heroku cron job help

开发者 https://www.devze.com 2023-02-24 10:27 出处:网络
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\"

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消