We are rolling out a new app with Sidekiq and Rails 5. We are leveraging Redis for storing jobs but for some reason both locally and on our dev zone the jobs don't seem to be passing into Redis.
When the code executes on its own as well as via IRB the Notification seems to be properly sent.
[10] pry(main)> Notifications::WelcomeWorker.perform_async(1)
=> "1a1447c488f173fb09b212f7"
Looking into Redis we have keys for failed and processed (both say 0) but nothing for pending which makes me believe it is not even hitting Redis for some reason.
Our Redis config is setup in config/sidekiq.yml which simply sets concurrency and the PID location.
We have an initializer file as well in initializers/sidekiq.rb
Sidekiq.configure_server do |config|
  config.redis = { url: ENV["SIDEKIQ_REDIS"] , namespace: 'abcbh', network_timeout: 5  }
end
Sidekiq.configure_client do |config|
  config.redis = { url: ENV["SIDEKIQ_REDIS"] , namespace: 'abcbh', network_timeout: 5  }
end
SIDEKIQ_REDIS translates to redis://localhost locally and the relevant URL on dev.
Everything seems to work fine and yet the jobs do not seem to appear in Redis.
Is there something I am missing in my sleep deprivation?
The worker itself is setup in app/workers/notifications/welcome_worker.rb
In app/workers/notifications/welcome_worker.rb we have the following code though it never gets executed.
require 'sendgrid-ruby'
include SendGrid
class Notifications::WelcomeWorker
  include Sidekiq::Worker
  sidekiq_retries_exhausted do |msg, e|
    Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}"
  end
  def perform(email_id)
    Sidekiq.logger.info "Beginning Welcome Email For #{email_id}"
    ...
  end
end
After additional Google-fu I found the issue already reported
Sidekiq worker not getting triggered - Please upvote this question and answer if you have come here for the same probelm. They deserve it more!
TL:DR - rspec-sidekiq gem should be in test only. Apparently this screws with development.
I will now go bang my head against a wall and wonder why my google-fu failed me for two days straight.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With