mirror of https://github.com/go-redis/redis.git
Merge pull request #774 from robinhoodmarkets/fix-cluster-copy
reset cmdable.process when copying cluster client
This commit is contained in:
commit
0f9028adf0
|
@ -650,7 +650,7 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
||||||
c.processPipeline = c.defaultProcessPipeline
|
c.processPipeline = c.defaultProcessPipeline
|
||||||
c.processTxPipeline = c.defaultProcessTxPipeline
|
c.processTxPipeline = c.defaultProcessTxPipeline
|
||||||
|
|
||||||
c.cmdable.setProcessor(c.Process)
|
c.init()
|
||||||
|
|
||||||
_, _ = c.state.Reload()
|
_, _ = c.state.Reload()
|
||||||
if opt.IdleCheckFrequency > 0 {
|
if opt.IdleCheckFrequency > 0 {
|
||||||
|
@ -660,6 +660,10 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ClusterClient) init() {
|
||||||
|
c.cmdable.setProcessor(c.Process)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ClusterClient) Context() context.Context {
|
func (c *ClusterClient) Context() context.Context {
|
||||||
if c.ctx != nil {
|
if c.ctx != nil {
|
||||||
return c.ctx
|
return c.ctx
|
||||||
|
@ -678,6 +682,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {
|
||||||
|
|
||||||
func (c *ClusterClient) copy() *ClusterClient {
|
func (c *ClusterClient) copy() *ClusterClient {
|
||||||
cp := *c
|
cp := *c
|
||||||
|
cp.init()
|
||||||
return &cp
|
return &cp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue