2
votes

I have a problem with sidekiq/activejob integration. I have a controller that calls a perform_later method from a MyJob class. This works with the perform method, but when I change to perfom_later, the job is scheduled in my development log. However, when I see the sidekiq dashboard, at the retries section, I can see NameError: uninitialized constant (look below image)

image

These are my files:

# app/jobs/crime_job.rb
class CrimeJob < ActiveJob::Base
  queue_as :default

  def perform(crime)
    puts "Perform #{crime}"
  end

  def self.job_name(crime)
    "RadarCrime:#{crime.id}"
  end 
end

Crime Controller

# app/controllers/crime_controller.rb
def show
  # [...]
  CrimeJob.perform_later(@crime)
end

Sidekiq initializer

# config/initializers/active_job.rb
Rails.application.config.active_job.queue_adapter = :sidekiq
1
Could you show us the full trace please? Also, it looks like you haven't defined the perform_later method in class CrimeJobDarkmouse
just to make sure, you are using rails4.2 ?Mohammad AbuShady

1 Answers

4
votes

Well, I also open an issue in Sidekiq repository, and the solution is easier than I've think.

Just restart the sidekiq process and it's works fine.

Issue link: https://github.com/mperham/sidekiq/issues/2207