Skip to content

Commit

Permalink
Print client redis connection info on pool creation, fixes #858
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Apr 17, 2013
1 parent 2b8e3bd commit 5ef13ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/sidekiq/redis_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ def self.create(options={})
# need a connection for Fetcher and Retry
size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 2) : 5)

if !Sidekiq.server?
opts = options.dup
opts.delete(:url)
Sidekiq.logger.info("#{Sidekiq::NAME} client using #{url} with options #{opts}")
end

ConnectionPool.new(:timeout => 1, :size => size) do
build_client(url, options[:namespace], options[:driver] || 'ruby')
end
Expand Down

3 comments on commit 5ef13ce

@coneybeare
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually pretty annoying, especially on tests. Is there a way to silence this so I don't see test output like this:

......................................2014-03-08T00:21:11Z 25035 TID-zns44g INFO: Sidekiq client with redis options {:url=>"redis://127.0.0.1:6391/0"}
...............................................................................................................................................................................................

@mperham
Copy link
Collaborator Author

@mperham mperham commented on 5ef13ce Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in your sidekiq initializer:

Sidekiq.logger.log_level = Logger::WARN

You can see the reasoning behind the change in the linked issue.

@coneybeare
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, I quickly silenced it like this:

Sidekiq.configure_server do |config|
  config.redis = { :url => "#{REDIS.client.scheme}://#{REDIS.client.host}:#{REDIS.client.port}/#{REDIS.client.db}" }
  if Rails.env.test?
    config.logger = nil
  end
end

Please sign in to comment.