diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-04-29 22:43:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 22:43:07 +0200 |
commit | 7b0fe4aef97c6a5f73a03146b669a415f396799c (patch) | |
tree | 328a1117bf021f1ffc0e126e9563f71b31862f1e /app/lib | |
parent | 6476f7e4da4da7c353d497aae5a86fc3909ce532 (diff) |
Fix opening and closing Redis connections instead of using a pool (#18171)
* Fix opening and closing Redis connections instead of using a pool * Fix Redis connections not being returned to the pool in CLI commands
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/redis_configuration.rb | 7 |
1 files changed, 6 insertions, 1 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 |