Fixed race condition

This commit is contained in:
Xavi Ramirez 2017-07-18 19:13:39 +00:00
parent 8bcef6cd91
commit a329c40645

View file

@ -133,8 +133,10 @@ func (b *batcher) batchSize(batch [][]byte) int {
func (b *batcher) flush(batch [][]byte) [][]byte { func (b *batcher) flush(batch [][]byte) [][]byte {
if len(batch) > 0 { if len(batch) > 0 {
b.mux.Lock()
b.sync.SendBatch(batch) b.sync.SendBatch(batch)
b.smallestSeq = SequencePair{nil, 0} b.smallestSeq = SequencePair{nil, 0}
b.mux.Unlock()
} }
return [][]byte{} return [][]byte{}
} }