fix redis sentinel url parse

This commit is contained in:
Zhidong Chen
2022-09-09 10:27:02 +08:00
committed by Ken Hibino
parent c70ff6a335
commit c08f142b56
2 changed files with 4 additions and 4 deletions

View File

@@ -519,7 +519,7 @@ func parseRedisSentinelURI(u *url.URL) (RedisConnOpt, error) {
if v, ok := u.User.Password(); ok { if v, ok := u.User.Password(); ok {
password = v password = v
} }
return RedisFailoverClientOpt{MasterName: master, SentinelAddrs: addrs, Password: password}, nil return RedisFailoverClientOpt{MasterName: master, SentinelAddrs: addrs, SentinelPassword: password}, nil
} }
// ResultWriter is a client interface to write result data for a task. // ResultWriter is a client interface to write result data for a task.

View File

@@ -145,7 +145,7 @@ func TestParseRedisURI(t *testing.T) {
RedisFailoverClientOpt{ RedisFailoverClientOpt{
MasterName: "mymaster", MasterName: "mymaster",
SentinelAddrs: []string{"localhost:5000", "localhost:5001", "localhost:5002"}, SentinelAddrs: []string{"localhost:5000", "localhost:5001", "localhost:5002"},
Password: "mypassword", SentinelPassword: "mypassword",
}, },
}, },
} }