From d790448589242fab1e0c7434d1f39b1f5b557f95 Mon Sep 17 00:00:00 2001 From: Nathan Ziebart Date: Wed, 23 May 2018 17:30:50 -0700 Subject: [PATCH] reset cmdable.process when copying cluster client --- cluster.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cluster.go b/cluster.go index c08c00d..6f0855e 100644 --- a/cluster.go +++ b/cluster.go @@ -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 }