Schedule Tasks With Ruby on Rails
“There cannot be a crisis next week. My schedule is already full.” This cheeky quote by Henry Kissinger explains the importance of having a schedule. In life or in tech, scheduling are important.
When it comes to Ruby on Rails which prefers convention over configuration, a scheduler is a must. Scheduling job can be defined as “a decision process of committing resources between varieties of tasks”. It is basically a function enabling one to perform routine tasks as part of a sequence or during predefined time like performing maintenance operations on retrieving RSS feeds. These scheduled jobs which are performed in the background are executed by ‘workers’.
So what are the best ways to schedule a task in Rails environment? Usually, developers can use application specific cron jobs to run the tasks however, cron jobs are for scheduling things, not actually performing them. It also works well on a single server but in case you want to scale to multiple server, it doesn’t work that good. They are also difficult to debug and are time consuming. So, how can you ensure that your scheduling works well and without any dependency or too much syntax. ‘Whenever’ comes to your rescue! Check out how ‘whenever’ gem can help you create cron jobs with Ruby.
Read full article about Whenever gem