@@ -632,14 +632,14 @@ func (c *clusterStateHolder) Reload(ctx context.Context) (*clusterState, error)
632
632
return state , nil
633
633
}
634
634
635
- func (c * clusterStateHolder ) LazyReload (ctx context. Context ) {
635
+ func (c * clusterStateHolder ) LazyReload () {
636
636
if ! atomic .CompareAndSwapUint32 (& c .reloading , 0 , 1 ) {
637
637
return
638
638
}
639
639
go func () {
640
640
defer atomic .StoreUint32 (& c .reloading , 0 )
641
641
642
- _ , err := c .Reload (ctx )
642
+ _ , err := c .Reload (context . Background () )
643
643
if err != nil {
644
644
return
645
645
}
@@ -652,7 +652,7 @@ func (c *clusterStateHolder) Get(ctx context.Context) (*clusterState, error) {
652
652
if v != nil {
653
653
state := v .(* clusterState )
654
654
if time .Since (state .createdAt ) > 10 * time .Second {
655
- c .LazyReload (ctx )
655
+ c .LazyReload ()
656
656
}
657
657
return state , nil
658
658
}
@@ -732,7 +732,7 @@ func (c *ClusterClient) Options() *ClusterOptions {
732
732
// ReloadState reloads cluster state. If available it calls ClusterSlots func
733
733
// to get cluster slots information.
734
734
func (c * ClusterClient ) ReloadState (ctx context.Context ) {
735
- c .state .LazyReload (ctx )
735
+ c .state .LazyReload ()
736
736
}
737
737
738
738
// Close closes the cluster client, releasing any open resources.
@@ -793,7 +793,7 @@ func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
793
793
}
794
794
if isReadOnly := isReadOnlyError (lastErr ); isReadOnly || lastErr == pool .ErrClosed {
795
795
if isReadOnly {
796
- c .state .LazyReload (ctx )
796
+ c .state .LazyReload ()
797
797
}
798
798
node = nil
799
799
continue
@@ -1228,7 +1228,7 @@ func (c *ClusterClient) checkMovedErr(
1228
1228
}
1229
1229
1230
1230
if moved {
1231
- c .state .LazyReload (ctx )
1231
+ c .state .LazyReload ()
1232
1232
failedCmds .Add (node , cmd )
1233
1233
return true
1234
1234
}
@@ -1414,7 +1414,7 @@ func (c *ClusterClient) cmdsMoved(
1414
1414
}
1415
1415
1416
1416
if moved {
1417
- c .state .LazyReload (ctx )
1417
+ c .state .LazyReload ()
1418
1418
for _ , cmd := range cmds {
1419
1419
failedCmds .Add (node , cmd )
1420
1420
}
@@ -1472,7 +1472,7 @@ func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...s
1472
1472
1473
1473
if isReadOnly := isReadOnlyError (err ); isReadOnly || err == pool .ErrClosed {
1474
1474
if isReadOnly {
1475
- c .state .LazyReload (ctx )
1475
+ c .state .LazyReload ()
1476
1476
}
1477
1477
node , err = c .slotMasterNode (ctx , slot )
1478
1478
if err != nil {
0 commit comments