I'm not having much luck with background queues at the moment. I'm attempting to get Resque to work. I've installed redis and the Resque gem.
Redis is running. A worker is running (rake resque:work QUEUE=simple). Using the web interface I can see that the worker is running and awaiting a job.
When I run 'rake get_updates', the job is queued but fails. I've tried it both with def self.perform and def perform.
clockwork.rake
task :get_updates => :environment do
Resque.enqueue(GetUpdates)
end
Class file (app/workers/get_updates.rb)
class GetUpdates
@queue = :simple
def perform
puts "Running GetUpdates"
end
end
Error Message
undefined method `perform' for GetUpdates:Class
/Users/lukesmith/.rvm/gems/ruby-1.9.3-p327/bundler/gems/resque-620d354454b8/lib/resque/job_performer.rb:79:in `perform_job'
/Users/lukesmith/.rvm/gems/ruby-1.9.3-p327/bundler/gems/resque-620d354454b8/lib/resque/job_performer.rb:46:in `execute_job'
/Users/lukesmith/.rvm/gems/ruby-1.9.3-p327/bundler/gems/resque-620d354454b8/lib/resque/job_performer.rb:25:in `perform'
perform
method should be class instance method.
class GetUpdates
@queue = :simple
def self.perform
puts "Running GetUpdates"
end
end
Did you try restarting resque after changing the method to self.perform. Quit the rake resque and start again after changing the method name to self.perform. This should work for sure.
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