Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4623

Uninitialized constant error with Sidekiq and Rails

$
0
0

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.3p105Sidekiq 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  endend

app/jobs/process_individual_email_notifications_job.rb

class ProcessIndividualEmailNotificationsJob < ApplicationJobqueue_as :default  def perform(user_id)     ...  endend

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","creat4: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 }endSidekiq.configure_server do |config|  config.redis = { :size => 25 }endSidekiq::Web.set :sessions, false

sidekiq.yml

:concurrency: 18development:  :verbose: true  :queues:    - [development_priority, 2]    - development_default    - development_mailersstaging:  :queues:    - [staging_priority, 2]    - staging_default    - staging_mailersproduction:  :queues:    - [production_priority, 2]    - production_default    - production_mailers

Viewing all articles
Browse latest Browse all 4623


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>