ruby on rails - How to tell if sidekiq is connected to redis server? -


using console, how can tell if sidekiq connected redis server? want able this:

if (sidekiq connected redis) # psuedo code   mrworker.perform_async('do_work', user.id) else   mrworker.new.perform('do_work', user.id) end 

you can use redis info provided sidekiq:

redis_info = sidekiq.redis { |conn| conn.info } redis_info['connected_clients'] # => "16" 

took sidekiq's sinatra status app.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -