mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Tweak auto-reloads
This commit is contained in:
10
cluster.go
10
cluster.go
@ -622,7 +622,7 @@ func (c *clusterStateHolder) LazyReload(ctx context.Context) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
}()
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ func (c *clusterStateHolder) Get(ctx context.Context) (*clusterState, error) {
|
||||
v := c.state.Load()
|
||||
if v != nil {
|
||||
state := v.(*clusterState)
|
||||
if time.Since(state.createdAt) > time.Minute {
|
||||
if time.Since(state.createdAt) > 10*time.Second {
|
||||
c.LazyReload(ctx)
|
||||
}
|
||||
return state, nil
|
||||
@ -780,9 +780,6 @@ func (c *ClusterClient) _process(ctx context.Context, cmd Cmder) error {
|
||||
if lastErr == nil {
|
||||
return nil
|
||||
}
|
||||
if lastErr != Nil {
|
||||
c.state.LazyReload(ctx)
|
||||
}
|
||||
if lastErr == pool.ErrClosed || isReadOnlyError(lastErr) {
|
||||
node = nil
|
||||
continue
|
||||
@ -1431,9 +1428,6 @@ func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...s
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
if err != Nil {
|
||||
c.state.LazyReload(ctx)
|
||||
}
|
||||
|
||||
moved, ask, addr := isMovedError(err)
|
||||
if moved || ask {
|
||||
|
Reference in New Issue
Block a user