forked from mirror/redis
Merge pull request #93 from go-redis/fix/dont-reset-clients
cluster: don't reset clients on MOVED.
This commit is contained in:
commit
593f01fceb
|
@ -35,7 +35,6 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
||||||
}
|
}
|
||||||
client.commandable.process = client.process
|
client.commandable.process = client.process
|
||||||
client.reloadIfDue()
|
client.reloadIfDue()
|
||||||
|
|
||||||
go client.reaper(time.NewTicker(5 * time.Minute))
|
go client.reaper(time.NewTicker(5 * time.Minute))
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
@ -44,6 +43,7 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
||||||
func (c *ClusterClient) Close() error {
|
func (c *ClusterClient) Close() error {
|
||||||
// TODO: close should make client unusable
|
// TODO: close should make client unusable
|
||||||
c.setSlots(nil)
|
c.setSlots(nil)
|
||||||
|
c.resetClients()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,6 @@ func (c *ClusterClient) resetClients() (err error) {
|
||||||
func (c *ClusterClient) setSlots(slots []ClusterSlotInfo) {
|
func (c *ClusterClient) setSlots(slots []ClusterSlotInfo) {
|
||||||
c.slotsMx.Lock()
|
c.slotsMx.Lock()
|
||||||
|
|
||||||
c.resetClients()
|
|
||||||
seen := make(map[string]struct{})
|
seen := make(map[string]struct{})
|
||||||
for _, addr := range c.addrs {
|
for _, addr := range c.addrs {
|
||||||
seen[addr] = struct{}{}
|
seen[addr] = struct{}{}
|
||||||
|
|
Loading…
Reference in New Issue