0
votes

I'm developing a web app where the main functionality involves running a scheduled job every Monday of every week. To do this, I am using APscheduler and a clock process that runs every week. Heroku recommends that you only use the clock process for scheduling the jobs and use a separate worker dyno to actually carry out the job:

...it’s important to note that no work should be done in the clock process itself for reasons already covered in the clock processes article. Instead schedule a background job that will perform the actual work invoked from the clock process.

However, I am also only on the free tier, which means I can only have one dyno other than my web dyno. So is there actually a downside to executing the actual work in the clock process?

Other answers say that the recommendation is just for "best practices", since long-running jobs may push the scheduler back and prevent other jobs from being scheduled. However, I only have one job, the job is expected to take about five minutes max, and is only executed once a week.

Any advice is appreciated!

1

1 Answers

0
votes

I asked this question to Heroku Support and this is the answer they gave me:

You are right, this is considered best practice. However, for small applications running how you are doing is going to be fine. Just note this doing this way isn't scalable. Eventually, once you have many jobs the scheduler has to run, it will be spending more of time doing the work rather than keeping the schedule. Once this happens jobs start being missed or pushed back. This why its best to keep the scheduler/clock process independent of the process doing the actual work.

TL;DR : Doing work in the clock process is okay if the work does not prevent the clock process from actually scheduling jobs. BUT this is not scalable, and for large projects should be avoided.