Resque - undefined execute method for a class

I was not very lucky with the background queues at the moment. I am trying to get Resque to work. I installed redis and gem Resque.

Redis is running. The worker is working (rake resque: work QUEUE = simple). Using the web interface, I see that the worker is working and waiting for work.

When I run "rake get_updates", the job is queued but not executed. I tried this with both def self.perform and def def.

clockwork.rake

task :get_updates => :environment do Resque.enqueue(GetUpdates) end 

Class file (application / 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' 
+4
source share
2 answers

perform method must be a class instance method.

 class GetUpdates @queue = :simple def self.perform puts "Running GetUpdates" end end 
+8
source

You tried to restart resque after changing the method to self.perform. Exit rake resque mode and start again after changing the method name in self.perform. That should work for sure.

+1
source

Source: https://habr.com/ru/post/1500685/


All Articles