resque/resque-scheduler

Environment specified through --environment is not honoured

leapingfrogs opened this issue · 0 comments

Our current usage of resque-scheduler was passing the environment through the command line as follows:

exec resque-scheduler -B --app-name somename --environment staging -p ${pidfile} -I ${app_dir}/deploy/resque_scheduler.rb --logfile ${app_dir}/log/resque-scheduler.stdout.log

I noticed that a scheduled job wasn't executing but would run fine when clicking the Queue Now button from the web interface. Further investigation of the running process showed it had the following name in the process list:

resque-scheduler-4.3.1[somename][development]: Schedules Loaded

It turned out that passing staging as our environment wasn't being correctly handled so the running process fell back to development and this particular schedule wasn't enabled for the development environment (all others were which is why we hadn't noticed this issue previously).

A workaround in the interim seems to be ensuring RAILS_ENV is set appropriately to allow the correct environment to be detected.