2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-26 07:42:17 +08:00

Add MaxRedirects field in RedisClusterClientOpt

This commit is contained in:
Ken Hibino 2020-09-08 05:56:45 -07:00
parent 6e294a7013
commit 450a9aa1e2

View File

@ -115,6 +115,11 @@ type RedisClusterClientOpt struct {
// A seed list of host:port addresses of cluster nodes.
Addrs []string
// The maximum number of retries before giving up.
// Command is retried on network errors and MOVED/ASK redirects.
// Default is 8 retries.
MaxRedirects int
// Username to authenticate the current connection when Redis ACLs are used.
// See: https://redis.io/commands/auth.
Username string
@ -251,6 +256,7 @@ func createRedisClient(r RedisConnOpt) redis.UniversalClient {
case RedisClusterClientOpt:
return redis.NewClusterClient(&redis.ClusterOptions{
Addrs: r.Addrs,
MaxRedirects: r.MaxRedirects,
Username: r.Username,
Password: r.Password,
TLSConfig: r.TLSConfig,
@ -258,6 +264,7 @@ func createRedisClient(r RedisConnOpt) redis.UniversalClient {
case *RedisClusterClientOpt:
return redis.NewClusterClient(&redis.ClusterOptions{
Addrs: r.Addrs,
MaxRedirects: r.MaxRedirects,
Username: r.Username,
Password: r.Password,
TLSConfig: r.TLSConfig,