chore: Use multiple connections in Redis connection pool (#5574)

- The initializer set up a connection pool, but both pools created namespace wrappers around a single global connection. Splitting them up.
This commit is contained in:
Stephen Paul Weber 2022-11-01 18:49:26 -05:00 committed by GitHub
parent 00e06e5139
commit f2753df8df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,14 @@
redis = Rails.env.test? ? MockRedis.new : Redis.new(Redis::Config.app)
# Alfred
# Add here as you use it for more features
# Used for Round Robin, Conversation Emails & Online Presence
$alfred = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis::Namespace.new('alfred', redis: redis, warning: true) }
$alfred = ConnectionPool::Wrapper.new(size: 5, timeout: 3) do
redis = Rails.env.test? ? MockRedis.new : Redis.new(Redis::Config.app)
Redis::Namespace.new('alfred', redis: redis, warning: true)
end
# Velma : Determined protector
# used in rack attack
$velma = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis::Namespace.new('velma', redis: redis, warning: true) }
$velma = ConnectionPool::Wrapper.new(size: 5, timeout: 3) do
redis = Rails.env.test? ? MockRedis.new : Redis.new(Redis::Config.app)
Redis::Namespace.new('velma', redis: redis, warning: true)
end