mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(POOLER-184) Pool manager retry and exit on failure
Adding a reconnect retry for redis, which by default would retry 10 times, for a total wait time of ~80 seconds
This commit is contained in:
parent
bdf77a9e33
commit
a35d66c606
3 changed files with 14 additions and 5 deletions
|
|
@ -164,7 +164,7 @@ module Vmpooler
|
|||
pools
|
||||
end
|
||||
|
||||
def self.redis_connection_pool(host, port, password, size, timeout, metrics)
|
||||
def self.redis_connection_pool(host, port, password, size, timeout, metrics, redis_reconnect_attempts = 0)
|
||||
Vmpooler::PoolManager::GenericConnectionPool.new(
|
||||
metrics: metrics,
|
||||
connpool_type: 'redis_connection_pool',
|
||||
|
|
@ -173,13 +173,14 @@ module Vmpooler
|
|||
timeout: timeout
|
||||
) do
|
||||
connection = Concurrent::Hash.new
|
||||
redis = new_redis(host, port, password)
|
||||
redis = new_redis(host, port, password, redis_reconnect_attempts)
|
||||
connection['connection'] = redis
|
||||
end
|
||||
end
|
||||
|
||||
def self.new_redis(host = 'localhost', port = nil, password = nil)
|
||||
Redis.new(host: host, port: port, password: password)
|
||||
def self.new_redis(host = 'localhost', port = nil, password = nil, redis_reconnect_attempts = 10)
|
||||
Redis.new(host: host, port: port, password: password, reconnect_attempts: redis_reconnect_attempts, reconnect_delay: 1.5,
|
||||
reconnect_delay_max: 10.0)
|
||||
end
|
||||
|
||||
def self.pools(conf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue