I want to run a task every minute on Heroku to check if conditions are met to time-out certain user tasks. I can only run a Heroku cron job every hour, so what's the best way to set up a timed task like this. I am using Rails 3.1 on Heroku.
Clockwork is the way to go but I will suggest another workaround.
Use scheduler (every 10min) + delayed jobs to execute the task every minute. This seems a little bit more reliable solution than the one without scheduler.
MyJob.run!
(1..8).each |i|
MyJob.delay(run_at: i.minutes.from_now).run! # create 8 more jobs (each start 1 minute later)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With