I followed the tutorial at https://devcenter.heroku.com/articles/queuing-ruby-resque to queue and run background jobs in a Rails app. After queueing the jobs, it doesn't seem to run any of the jobs since in the console I can see the job has not been processed
>Resque.info
=> {:pending=>1, :processed=>0, :queues=>1, :workers=>0, :working=>0, :failed=>0, :servers=>["redis://dory.redistogo.com:9826/0"], :environment=>"production"}
If I try to do (locally)
bundle exec rake jobs:work
I get
rake aborted!
Don't know how to build task 'jobs:work'
On heroku, if I try
heroku run rake jobs:work
I again get `Don't know how to build task'
In my Rakefile, I have require 'resque/tasks'
and in my Procfile I have
resque: env TERM_CHILD=1 bundle exec rake jobs:work
resque: env TERM_CHILD=1 bundle exec rake jobs:work
I have the Resque and redis gems in my Gemfile, but not delayed_job.
Update: Here is my Rakefile:
#!/usr/bin/env rake
require File.expand_path('../config/application', __FILE__)
Guard::Application.load_tasks
/lib/tasks
is empty. I have a worker in app/workers that I am enqueueing in a controller.
This doesn't appear to have anything to do with Heroku, if it doesn't work locally. You'll have to reveal some of your source to help people help you. For example, what's your Rakefile look like? The demo app in that article defines one with a Rake task with the task. Have you defined your rake task and added the appropriate gem references?
Try resque:work
instead of jobs:work
and see if that beings the desired results.
You just need to add require 'resque/tasks'
in your Rakefile
, then on the command line:
QUEUE=file_serve rake environment resque:work
Where file_serve
is the name of your job (the class would be FileServeJob
).
See the docs here - I found them slightly confusing since the setup and run info comes after the job class creation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With