From db61fb7b6724ac8b5d52da18e9ef4153732a681d Mon Sep 17 00:00:00 2001 From: DanB Date: Tue, 4 Oct 2016 17:39:20 +0200 Subject: [PATCH] Redis close connections on pool reinit, thanks @eloycoto --- engine/storage_redis.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/storage_redis.go b/engine/storage_redis.go index c2a6a4869..666cbc02f 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -96,10 +96,8 @@ func (rs *RedisStorage) poolInit() (err error) { return err } -// This CMD function get a connection from the pool. Send the command and if -// the problem is a redis.IOError didn't add the connection in the pool and -// increase the pool with a new connection. Good for timeouts - +// This CMD function get a connection from the pool. +// Handles automatic failover in case of network disconnects func (rs *RedisStorage) Cmd(cmd string, args ...interface{}) *redis.Resp { rs.poolLock.RLock() c1, err := rs.dbPool.Get() @@ -122,6 +120,7 @@ func (rs *RedisStorage) Cmd(cmd string, args ...interface{}) *redis.Resp { return result2 } } + rs.Close() if err := rs.poolInit(); err != nil { break }