I've been getting a whole bunch of uninitialized constant errors lately and I can't figure out why. Below is a specific example. In this example, I am calling a job from within a job. But I am getting a similar uninitialized constant error will many of my other jobs. All jobs are in app/jobs. Am I missing something? Sidekiq has been working just fine until recently.
I've purged my Heroku cache and killed all retries in Sidekiq and I'm still getting these issues. There's something really strange here. With another error I'm getting related to a sidekiq job, I'm getting "wrong number of arguments (given 2, expected 1)". I updated the function in question to receive two arguments weeks ago. Is it possible that Sidekiq is somehow stuck on a cached version of the codebase?
Ruby version: ruby 2.5.3p105 Sidekiq version: 6.0.7
app/jobs/process_email_notifications_job.rb
class ProcessEmailNotificationsJob < ApplicationJob
queue_as :default
def perform
user_ids = UserNotification.where(is_read: false).pluck(:user_id).uniq
user_ids.each do |user_id|
ProcessIndividualEmailNotificationsJob.perform_later user_id
end
end
end
app/jobs/process_individual_email_notifications_job.rb
class ProcessIndividualEmailNotificationsJob < ApplicationJob
queue_as :default
def perform(user_id)
...
end
end
Error message:
2020-05-06T20:07:45.720Z pid=56028 tid=owp0sdcm8 DEBUG: enqueued retry: {"retry":true,"queue":"production_default","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ProcessIndividualEmailNotificationsJob","args":[{"job_class":"ProcessIndividualEmailNotificationsJob","job_id":"4b31bc4f-d034-4190-b24f-d0464cf81df0","provider_job_id":null,"queue_name":"production_default","priority":null,"arguments":[988],"executions":0,"locale":"en"}],"jid":"0ecc861f5870a7b9a70f176f","creat
4:07:45 PM sidekiq.1 | > ed_at":1588794273.2726498,"enqueued_at":1588795006.4009435,"error_message":"uninitialized constant ProcessIndividualEmailNotificationsJob\nDid you mean? ProcessEmailNotificationsJob","error_class":"NameError","failed_at":1588794279.9911764,"retry_count":5,"retried_at":1588795006.763224}
Initializer:
require 'sidekiq'
require 'sidekiq/web'
Sidekiq.configure_client do |config|
config.redis = { :size => 5 }
end
Sidekiq.configure_server do |config|
config.redis = { :size => 25 }
end
Sidekiq::Web.set :sessions, false
sidekiq.yml
:concurrency: 18
development:
:verbose: true
:queues:
- [development_priority, 2]
- development_default
- development_mailers
staging:
:queues:
- [staging_priority, 2]
- staging_default
- staging_mailers
production:
:queues:
- [production_priority, 2]
- production_default
- production_mailers