Skip to content

Commit

Permalink
fix when timeout return batch zero length
Browse files Browse the repository at this point in the history
  • Loading branch information
chaiwat-fg committed Mar 17, 2021
1 parent 99ea4fd commit 8e75b2a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions batching.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ func (b *Batching) Run() chan []interface{} {
batch = append(batch, data)
}
timer.Reset(b.maxTime)
batches <- batch
batch = []interface{}{}

if len(batch) > 0 {
batches <- batch
batch = []interface{}{}
}
//Data full capacity making batch
case b.isFullChan <- struct {}{}:
if len(b.dataChan) == cap(b.dataChan) {
Expand Down

0 comments on commit 8e75b2a

Please sign in to comment.