diff --git a/cluster.go b/cluster.go index 4747a0e..3db0c83 100644 --- a/cluster.go +++ b/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 { diff --git a/internal/hashtag/hashtag_test.go b/internal/hashtag/hashtag_test.go index c84e113..87aca6f 100644 --- a/internal/hashtag/hashtag_test.go +++ b/internal/hashtag/hashtag_test.go @@ -43,8 +43,8 @@ var _ = Describe("HashSlot", func() { {"{}foo", 9500}, {"foo{}", 5542}, {"foo{}{bar}", 8363}, - {"", 10503}, - {"", 5176}, + {"", 7404}, + {"", 4403}, {string([]byte{83, 153, 134, 118, 229, 214, 244, 75, 140, 37, 215, 215}), 5463}, } // Empty keys receive random slot.