Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku resque no worker

I have succesfully queued a job, which I can see in resque web.

But the job is never executeted, just pending. I have 1 worker on my heroku app. In resque stats the workers are 0.

In lib/tasks/resque.rb:

require 'resque/tasks'

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

  Resque.after_fork do |job|
    ActiveRecord::Base.establish_connection
  end

end

desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"
like image 499
Rails beginner Avatar asked Feb 18 '26 09:02

Rails beginner


1 Answers

You have to tell Heroku to start up your Resque workers via a Procfile. This is where you put the command you would run locally, like RAILS_ENV=Production QUEUE=* bundle exec rake jobs:work

This gives the added benefit of testing you Heroku Resque setup locally by using the same Profile to start Resque workers with Foreman.

Here is a link on the Heroku site that explains how to get that set up.

like image 82
Nick Messick Avatar answered Feb 21 '26 06:02

Nick Messick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!