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
RAILS_ENV? I once had a similar problem but simply over read that sidekiq will not run ondevelopmentenvironment (a few versions ago - don't know if this is default behavior). Have you looked at thesidekiq.logfor any errors? Other problem might be the log level... that is to low to show up depending on your configuration. - Mark