Rufus scheduler tasks on heroku running more often than scheduled
Asked Answered
M

1

4

I have a Rails app running on heroku with Rufus Scheduler added on.

A 'once a day' task in the scheduler is running more often than once a day.

My guess would be something to do with the heroku app running on different dynos during the day, but I'm at a loss on how to confirm/fix the problem.

Has anyone else seen this/know of a solution?

Edit: I couldn't resolve the problem with the gem and have moved my app over to the heroku scheduler add on which does not experience this problem.

Meaghan answered 6/2, 2012 at 5:23 Comment(1)
I'm having the same problem. Are you using multiple web dynos on your heroku install? If you start rufus scheduler using an initializer, it will be initialized once for every web dyno, hence it fires once for every dyno. I'm trying to start the scheduler on a worker thread using a Procfile, but haven't had any luck yet.Habited
H
0

The Heroku scheduler isn't guaranteed, it's only a simple scheduling system designed to fill a gap. It's nothing to do with your application moving between dynos as it's a seperate management system spinning up one of processes.

If timeliness is essential to you, take a look at clockwork, which will let you configure all sorts of stuff, but also give you a bit more reliability (at the expense of having a clock process running).

If this won't do - simply rework your job so that it doesn't matter how often it runs.

Heresiarch answered 6/2, 2012 at 9:10 Comment(1)
My question was about the rufus_scheduler gem, not the heroku scheduler. I couldn't resolve the problem with the gem and have moved my app over to the heroku scheduler add on which does not experience this problem.Meaghan

© 2022 - 2024 — McMap. All rights reserved.