Fixed race condition
This commit is contained in:
parent
8bcef6cd91
commit
a329c40645
1 changed files with 2 additions and 0 deletions
|
|
@ -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{}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue