8

Here is what I am trying to do:

2.1.2 :001 > UpdateStyleRanks.perform_async

Here is the error:

NoMethodError: undefined method `perform' for #<UpdateStyleRanks:0x00000002f5e388>

Here is my worker:

# app/workers/update_style_ranks.rb
class UpdateStyleRanks
  include Sidekiq::Worker

  def perform
  end
end
Abram
  • 39,950
  • 26
  • 134
  • 184

4 Answers4

5

There is no naming requirement for workers. You can do this:

class Foo
  include Sidekiq::Worker
  def perform; end
end

I suspect you just need to restart Rails/Spring/Zeus to pick up the new class.

Mike Perham
  • 21,300
  • 6
  • 59
  • 61
0

How would one restart a heroku dyno running in background?

heroku run:detached bundle exec sidekiq -e production

Would the following commands force sidekiq to pickup new class?

heroku ps:stop run

heroku run:detached bundle exec sidekiq -e production

Khoa Nguyen
  • 1,540
  • 2
  • 15
  • 21
0

In current versions of sidekiq (4 and 5) I believe the solution is to call perform_async and not perform.

fuzzygroup
  • 1,109
  • 12
  • 12
-2

You should rename you the file to update_style_rank_worker.rb
and the class name to UpdateStyleRankWorker

sonnyhe2002
  • 2,091
  • 3
  • 19
  • 31