From 5bdfb5070ca1c275302b463d2cbd5bbbcb855913 Mon Sep 17 00:00:00 2001 From: vinllen Date: Thu, 4 Jul 2019 16:12:37 +0800 Subject: [PATCH] fix batcher is nil --- src/redis-shake/common/cluster.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/redis-shake/common/cluster.go b/src/redis-shake/common/cluster.go index 08baeb6..a4cbeb7 100644 --- a/src/redis-shake/common/cluster.go +++ b/src/redis-shake/common/cluster.go @@ -54,9 +54,16 @@ func (cc *ClusterConn) Send(commandName string, args ...interface{}) error { // send batcher and put the return into recvChan func (cc *ClusterConn) Flush() error { ret, err := cc.client.RunBatch(cc.batcher) - cc.batcher = nil // reset batcher + defer func() { + cc.batcher = nil // reset batcher + }() if err != nil { + cc.recvChan <- reply{ + answer: nil, + err: err, + } + return err }