Skip to content

Commit 449a362

Browse files
committed
cluster: release reloading with delay.
1 parent 2507be6 commit 449a362

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cluster.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ func (c *ClusterClient) setSlots(slots []ClusterSlotInfo) {
214214
}
215215

216216
func (c *ClusterClient) reloadSlots() {
217-
defer atomic.StoreUint32(&c.reloading, 0)
217+
defer func() {
218+
// Release lock with delay so pending commands don't trigger
219+
// reload immediately.
220+
time.Sleep(time.Second)
221+
atomic.StoreUint32(&c.reloading, 0)
222+
}()
218223

219224
client, err := c.randomClient()
220225
if err != nil {

0 commit comments

Comments
 (0)