try to fix #19 (#52)

Signed-off-by: longfangsong <longfangsong@icloud.com>
This commit is contained in:
龙方淞 2020-08-24 11:28:10 +08:00 committed by GitHub
parent 095b94dc24
commit 9577439310
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

2
go.mod
View File

@ -51,4 +51,4 @@ require (
google.golang.org/grpc v1.19.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
)
)

View File

@ -390,6 +390,10 @@ func (a *connArray) batchSendLoop() {
}
length := len(requests)
if uint(length) == 0 {
// The batch command channel is closed.
return
}
maxBatchID := atomic.AddUint64(&batchCommandsClient.idAlloc, uint64(length))
for i := 0; i < length; i++ {
requestID := uint64(i) + maxBatchID - uint64(length)