My Rails 5 application should rely upon the execution of tasks at a specific time: a task every Monday at 8:00 am (except in December), a task any time the 1st of January, a task before 10 am the 1st of December and a task every 1st of each month of the year.
All these tasks should be executed only once.
At first I thought the Heroku Scheduler app could be the right choice, but in my opinion this is not suitable to my needs and might be not a good idea. The Heroku Scheduler looks quite too simplistic a solution because it can be used only for daily, hourly or every 10 minutes tasks, and Heroku warns that “Scheduler is a “best effort” service, meaning that execution is expected
but not guaranteed. Scheduler is known to occasionally (but rarely) miss the execution of scheduled jobs.”
I already written my tasks using conditionals such as:
if Time.now.monday? && !(Time.now.month == 12) && (Time.now.hour == 8)
But I would not be so sure the Heroku Scheduler would execute it.
Heroku advises that “if scheduled jobs are a critical component of your application, it is recommended to run a custom clock process instead for more reliability, control, and visibility.”
Custom clock processes are poorly described at Heroku, but it seems clear that “custom clock implementations vary greatly by language”.
So, as far as Rails is concerned, I first bumped into JohnDel’s answer at Stackoverflow, then I discovered that I might use Active Job plus a 3rd-party queuing library as a queuing backend.
The page Active Job Basics at railsguides are to my understanding quite too basic. For instance there are not useful examples for method ‘perform’ in chapter 3.1, it is not clear where method ‘perfom_later’ in chapter 3.2 comes from. what other specific queues there are apart from ‘low_priority’…
What solution would you suggest?
If you too think that Active Job is the rails way to do the job, I would greatly appreciate if you could suggest me, a total newbie to this topic, useful and comprehensive documentation for Active Job and for the queuing libraries and queue backends you consider the most suitable and appropriate.