How to implement something like cron jobs on Rails 4 -
i'm developing app in rails 4 , not sure how implement feature: need implement sort of cron job. instance, let's create invoice in app. need app check invoice due date , send reminder customer invoice hasn't been paid. want achieve without input user.
how can achieve this?
i've been thinking , thought use tool whenever check db every often.
but there way it? more efficient?
thanks
edit: inefficiencies i'm trying avoid:
the way envisaged work is:
- an invoice created. due date selected. date automatically added collection (i'm using mongoid, same table)
- every day whenever (the gem) or cron job fire script/method/function check aforementioned collection entries. if finds entries due dates within time-range (due within 3 days instance) fire script/method notify customer invoice due.
my concern if there thousands of invoices, might quite resource intensive check entries , check whether they're within specific time range. so, there better solution?
as alternative cron use gem delayed job:
https://github.com/amitree/delayed_job_recurring
sidekiq has periodic jobs(although present in sidekiq pro):
Comments
Post a Comment