forked from mirror/redis
cluster: don't reset clients when slots are changed.
This commit is contained in:
parent
6313dc03a7
commit
46527c872d
|
@ -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