adding IdleTimeout with the redis-connection-idle-timeout flag, to ke… (#1691)

* adding IdleTimeout with the redis-connection-idle-timeout flag, to keep redis connections in valid state, when Redis  option is set

* docs update - add redis idle timeout configurations

* changelog update for #1691 fix
This commit is contained in:
Dmitry Kartsev
2022-08-09 21:57:13 +01:00
committed by GitHub
parent 6e02bb496b
commit 0cfb9c6da0
6 changed files with 17 additions and 5 deletions
+7 -3
View File
@@ -104,6 +104,7 @@ func buildSentinelClient(opts options.RedisStoreOptions) (Client, error) {
SentinelPassword: opts.SentinelPassword,
Password: opts.Password,
TLSConfig: opt.TLSConfig,
IdleTimeout: time.Duration(opts.IdleTimeout) * time.Second,
})
return newClient(client), nil
}
@@ -120,9 +121,10 @@ func buildClusterClient(opts options.RedisStoreOptions) (Client, error) {
}
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addrs,
Password: opts.Password,
TLSConfig: opt.TLSConfig,
Addrs: addrs,
Password: opts.Password,
TLSConfig: opt.TLSConfig,
IdleTimeout: time.Duration(opts.IdleTimeout) * time.Second,
})
return newClusterClient(client), nil
}
@@ -143,6 +145,8 @@ func buildStandaloneClient(opts options.RedisStoreOptions) (Client, error) {
return nil, err
}
opt.IdleTimeout = time.Duration(opts.IdleTimeout) * time.Second
client := redis.NewClient(opt)
return newClient(client), nil
}