0

I want to schedule sending mails using Rufus-scheduler in a Rails app deployed on Heroku.

My code looks like

# config/initializers/scheduler.rb
require 'rufus-scheduler'
s = Rufus::Scheduler.singleton
s.every '11h30m' do
# here I put my sending mail task (already tested, and works well)
end

But nothing happened, and I can't figure out the issue based on my logs

I suspected some points:

1- Is my procfile correct ? Do I need something else in order to use Passenger ? will the classic webrick server work ?

web: bundle exec passenger start -p $PORT --max-pool-size 3 --min-instances 

2- I do not have a paid worker on Heroku, can I make Rufus-scheduler works with only one free standard web Dyno ?

3- If OK for the 2 questions, do I need to add something else to make the code works ?

Many thanks

Abdel
  • 71
  • 8
  • I dont have much insight on Rufus Scheduler but to your second point, using background jobs on a web-dyno are not a good idea since web-dynos timeout after 30 seconds. If your process doesn't finish by then it will error out and the job will not run again until its next scheduled attempt. Worker dynos don't suffer from this timeout so keep that in mind while you troubleshoot your main issues! – bkunzi01 Feb 26 '16 at 13:14
  • In fact, the task which is sent, takes around 2 minutes to be prepared (scraped from a site); so there is no way to use Rufus with web-dyno ? I've understood from this post that it could be possible [link](http://stackoverflow.com/questions/20490401/how-to-get-rufus-scheduler-working-with-a-rails-app-deployed-to-heroku?rq=1) Thank you – Abdel Feb 26 '16 at 16:54

0 Answers0