Skip to content

Commit 840c25c

Browse files
authored
feat: add field protocol to setupClusterQueryParams (#2600)
1 parent 3917988 commit 840c25c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cluster.go

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ func setupClusterConn(u *url.URL, host string, o *ClusterOptions) (*ClusterOptio
217217
func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, error) {
218218
q := queryOptions{q: u.Query()}
219219

220+
o.Protocol = q.int("protocol")
220221
o.ClientName = q.string("client_name")
221222
o.MaxRedirects = q.int("max_redirects")
222223
o.ReadOnly = q.bool("read_only")

cluster_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,10 @@ var _ = Describe("ClusterClient ParseURL", func() {
15191519
test: "UseDefault",
15201520
url: "redis://localhost:123?conn_max_idle_time=",
15211521
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, ConnMaxIdleTime: 0},
1522+
}, {
1523+
test: "Protocol",
1524+
url: "redis://localhost:123?protocol=2",
1525+
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, Protocol: 2},
15221526
}, {
15231527
test: "ClientName",
15241528
url: "redis://localhost:123?client_name=cluster_hi",

0 commit comments

Comments
 (0)