diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/redis_configuration.rb | 7 | ||||
-rw-r--r-- | app/models/concerns/redisable.rb | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/lib/redis_configuration.rb b/app/lib/redis_configuration.rb index fc8cf2f80..e14d6c8b6 100644 --- a/app/lib/redis_configuration.rb +++ b/app/lib/redis_configuration.rb @@ -2,12 +2,17 @@ class RedisConfiguration class << self + def establish_pool(new_pool_size) + @pool&.shutdown(&:close) + @pool = ConnectionPool.new(size: new_pool_size) { new.connection } + end + def with pool.with { |redis| yield redis } end def pool - @pool ||= ConnectionPool.new(size: pool_size) { new.connection } + @pool ||= establish_pool(pool_size) end def pool_size diff --git a/app/models/concerns/redisable.rb b/app/models/concerns/redisable.rb index cce8efb86..8d76b6b82 100644 --- a/app/models/concerns/redisable.rb +++ b/app/models/concerns/redisable.rb @@ -6,6 +6,6 @@ module Redisable private def redis - Thread.current[:redis] ||= RedisConfiguration.new.connection + Thread.current[:redis] ||= RedisConfiguration.pool.checkout end end |