joseph.hainline
joseph.hainline

Reputation: 26608

Setting up Resque in Rails

When setting up Resque for the first time in Rails, I'm getting an error. I'm using Foreman and a Procfile to start my app locally, before eventual deployment to Heroku. Redis and my PostgreSQL database are already running when I try to start my app. The error is:

$ foreman start
...
23:24:32 resque.1 | rake aborted!
23:24:32 resque.1 | No such file to load -- bootstrap_flash_helper
23:24:32 resque.1 | Tasks: TOP => resque:work => resque:preload
23:24:32 resque.1 | (See full trace by running task with --trace)
23:24:32 resque.1 | exited with code 1
...

My app does use Bootstrap, but I'm not explicitly requiring it in any classes using Rescue. My Rakefile and Procfile are:

Procfile

web: bundle exec rails server -p $PORT
resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=10 bundle exec rake resque:work

Rakefile

require File.expand_path('../config/application', __FILE__)
require 'resque/tasks'

task "resque:setup" do
  ENV['QUEUE'] = '*'
end

task "jobs:work" => "resque:work"

MyCoolApp::Application.load_tasks

Upvotes: 1

Views: 2026

Answers (2)

raven
raven

Reputation: 188

Just use

bundle exec rake environment resque:work

this does the same thing with task "resque:preload" => :environment.

require current environment when running the task :p

Upvotes: 3

joseph.hainline
joseph.hainline

Reputation: 26608

I don't fully understand this, but wanted to document it in case it helps someone. I needed the line:

task "resque:preload" => :environment

in my Rakefile right after the require statements. If anyone knows how this works, please clarify!

Upvotes: 2

Related Questions