Skip to content

Commit

Permalink
reset cmdable.process when copying cluster client
Browse files Browse the repository at this point in the history
  • Loading branch information
nziebart committed May 24, 2018
1 parent e3d9f9d commit d790448
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -678,6 +682,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {

func (c *ClusterClient) copy() *ClusterClient {
cp := *c
cp.init()
return &cp
}

Expand Down

0 comments on commit d790448

Please sign in to comment.