rails 3.1 Whenever gem works in development but not in production. Why?

1.2k Views Asked by At

Rails 3.1 + Whenever gem. I've got 2 jobs scheduled in Whenever. However, apparently nothing happens. I have tried these methods through Heroku console, and they work. So I reckon that they do not get fired at any point. Am I missing something?

config/schulde.rb

every 1.day, :at => '03:30' do
 runner "Alarm.proba"
end

every 1.day, :at=> '3:32 am' do
 runner "Alarm.proba2"
end

Alarm model

def self.proba
 @event = Event.find(10)
 @user =User.find(12)
 EventNotifier.alarm(@event, @user).deliver
end

def self.proba2
 @event = Event.find(10)
 @user =User.find(13)
 EventNotifier.alarm(@event, @user).deliver
end

$ crontab -l

# Begin Whenever generated tasks for: quasi
5 4 * * * /bin/bash -l -c 'cd /Users/sergioabendivar/railsProjects/Tutos/quasi && script/rails runner -e production '\''Alarm.proba'\'''

5 4 * * * /bin/bash -l -c 'cd /Users/sergioabendivar/railsProjects/Tutos/quasi && script/rails runner -e production '\''Alarm.proba2'\'''

I assume that it woks in development because my console now says "You have an email". Actually if I check the email I got quite a lot.

1

There are 1 best solutions below

0
Neal On

Use Heroku Scheduler instead: https://devcenter.heroku.com/articles/scheduler