Skip to content

Commit 0f9028a

Browse files
authored
Merge pull request #774 from robinhoodmarkets/fix-cluster-copy
reset cmdable.process when copying cluster client
2 parents e3d9f9d + d790448 commit 0f9028a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cluster.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
650650
c.processPipeline = c.defaultProcessPipeline
651651
c.processTxPipeline = c.defaultProcessTxPipeline
652652

653-
c.cmdable.setProcessor(c.Process)
653+
c.init()
654654

655655
_, _ = c.state.Reload()
656656
if opt.IdleCheckFrequency > 0 {
@@ -660,6 +660,10 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
660660
return c
661661
}
662662

663+
func (c *ClusterClient) init() {
664+
c.cmdable.setProcessor(c.Process)
665+
}
666+
663667
func (c *ClusterClient) Context() context.Context {
664668
if c.ctx != nil {
665669
return c.ctx
@@ -678,6 +682,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {
678682

679683
func (c *ClusterClient) copy() *ClusterClient {
680684
cp := *c
685+
cp.init()
681686
return &cp
682687
}
683688

0 commit comments

Comments
 (0)