Hey, I'm with a problem in sidekiq/activejob integration. I've a controller that call a perform_later from a MyJob class. So, with perform method, this works fine, but when I change to perfom_later, the job is scheduled in my development log, but when I seeing the sidekiq dashboard, at retries section, I can see NameError: uninitialized constant (look below image)

These 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
restart sidekiq.
@seuros, Thanks. It's works. Every change in my job file I need restart sidekiq :/ So boring. I'll close the issue.
@marciovicente Reloading is not thread-safe so Sidekiq can't use it. OTOH, Workers are designed to be very easy to TDD. If you use TDD, you'll find you don't need to restart Sidekiq much at all.
Can you please tell me what should I start first rails server or sidekiq to eager load active job class. I tried restarting sidekiq but still getting same error uninitialized constant. Do I need to restart rails server after sidekiq start or vice-versa ?
Please don't hijack other people's issues with your own problems. Open a new issue.
I've got 2 apps on the same server. Restarting the sidekiq job associated to the app was not enough. I had to restart all sidekiq process for both apps.
Most helpful comment
restart sidekiq.