mirror of https://github.com/go-redis/redis.git
Reload state on read only error
This commit is contained in:
parent
ac72610544
commit
dc52593c8c
10
cluster.go
10
cluster.go
|
@ -780,7 +780,10 @@ func (c *ClusterClient) _process(ctx context.Context, cmd Cmder) error {
|
||||||
if lastErr == nil {
|
if lastErr == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if lastErr == pool.ErrClosed || isReadOnlyError(lastErr) {
|
if isReadOnly := isReadOnlyError(lastErr); isReadOnly || lastErr == pool.ErrClosed {
|
||||||
|
if isReadOnly {
|
||||||
|
c.state.LazyReload(ctx)
|
||||||
|
}
|
||||||
node = nil
|
node = nil
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -1438,7 +1441,10 @@ func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...s
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == pool.ErrClosed || isReadOnlyError(err) {
|
if isReadOnly := isReadOnlyError(err); isReadOnly || err == pool.ErrClosed {
|
||||||
|
if isReadOnly {
|
||||||
|
c.state.LazyReload(ctx)
|
||||||
|
}
|
||||||
node, err = c.slotMasterNode(ctx, slot)
|
node, err = c.slotMasterNode(ctx, slot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue