1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-25 08:21:55 +03:00

reset cmdable.process when copying cluster client

This commit is contained in:
Nathan Ziebart
2018-05-23 17:30:50 -07:00
parent e3d9f9d1c7
commit d790448589

View File

@ -650,7 +650,7 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
c.processPipeline = c.defaultProcessPipeline
c.processTxPipeline = c.defaultProcessTxPipeline
c.cmdable.setProcessor(c.Process)
c.init()
_, _ = c.state.Reload()
if opt.IdleCheckFrequency > 0 {
@ -660,6 +660,10 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
return c
}
func (c *ClusterClient) init() {
c.cmdable.setProcessor(c.Process)
}
func (c *ClusterClient) Context() context.Context {
if c.ctx != nil {
return c.ctx
@ -678,6 +682,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {
func (c *ClusterClient) copy() *ClusterClient {
cp := *c
cp.init()
return &cp
}