From 84cd16e214b89c1d50cd57b99ada642119a82479 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 13 May 2015 12:38:34 +0300 Subject: [PATCH 1/2] cluster: user ClusterInfo instead of Ping to find live node. --- cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index 20ecbe9..d09298e 100644 --- a/cluster.go +++ b/cluster.go @@ -97,7 +97,7 @@ func (c *ClusterClient) slotAddrs(slot int) []string { return addrs } -// randomClient returns a Client for the first pingable node. +// randomClient returns a Client for the first live node. func (c *ClusterClient) randomClient() (client *Client, err error) { for i := 0; i < 10; i++ { n := rand.Intn(len(c.addrs)) @@ -105,7 +105,7 @@ func (c *ClusterClient) randomClient() (client *Client, err error) { if err != nil { continue } - err = client.Ping().Err() + err = client.ClusterInfo().Err() if err == nil { return client, nil } From f24d3ff013afa1833cbd6f8f5a0872bcfcd22350 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 14 May 2015 14:54:38 +0300 Subject: [PATCH 2/2] Increase test timeout. --- cluster_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster_test.go b/cluster_test.go index 2ba8812..6ec8552 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -271,7 +271,7 @@ var _ = Describe("Cluster", func() { Eventually(func() []string { return client.SlotAddrs(slot) - }).Should(Equal([]string{"127.0.0.1:8221", "127.0.0.1:8224"})) + }, "5s").Should(Equal([]string{"127.0.0.1:8221", "127.0.0.1:8224"})) }) It("should perform multi-pipelines", func() {