I have a Rails app that is mostly using Redis for Sidekiq, but has a couple of other calls to Redis. I'd like to be able to use the same connection pool for these calls and Sidekiq, which would let me have only one Redis connection per thread.
e.g. with a setup like this
# initializers
threads = 5
$redis_pool = ConnectionPool.new(size: threads)
$redis = ConnectionPool::Wrapper.new(pool: $redis_pool)
Sidekiq.configure_client do |config|
config.redis = $redis_pool
end
I could have this code in a thread and only have one Redis connection checked in at the end.
I have a Rails app that is mostly using Redis for Sidekiq, but has a couple of other calls to Redis. I'd like to be able to use the same connection pool for these calls and Sidekiq, which would let me have only one Redis connection per thread.
e.g. with a setup like this
I could have this code in a thread and only have one Redis connection checked in at the end.
Am I missing something? Could this be useful for ConnectionPool?