Skip to content

Commit

Permalink
feat: add field protocol to setupClusterQueryParams (#2600)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljun20160606 committed May 18, 2023
1 parent 3917988 commit 840c25c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 840c25c

Please sign in to comment.