feat: add field protocol to setupClusterQueryParams (#2600)

This commit is contained in:
ljun20160606 2023-05-18 21:29:58 +08:00 committed by GitHub
parent 391798880c
commit 840c25cb6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -217,6 +217,7 @@ func setupClusterConn(u *url.URL, host string, o *ClusterOptions) (*ClusterOptio
func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, error) {
q := queryOptions{q: u.Query()}
o.Protocol = q.int("protocol")
o.ClientName = q.string("client_name")
o.MaxRedirects = q.int("max_redirects")
o.ReadOnly = q.bool("read_only")

View File

@ -1519,6 +1519,10 @@ var _ = Describe("ClusterClient ParseURL", func() {
test: "UseDefault",
url: "redis://localhost:123?conn_max_idle_time=",
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, ConnMaxIdleTime: 0},
}, {
test: "Protocol",
url: "redis://localhost:123?protocol=2",
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, Protocol: 2},
}, {
test: "ClientName",
url: "redis://localhost:123?client_name=cluster_hi",