Skip to content

Commit

Permalink
Fix MaxWait only configuration
Browse files Browse the repository at this point in the history
Don't quit when no Items are present after MaxWait passes. Instead, continue and wait for MaxItems or MaxWait to be reached again.
  • Loading branch information
DerBlum authored Jan 25, 2022
1 parent 450e3a5 commit 7e509ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (p *BatchProducer) WatchProducer() {
case <-time.After(p.MaxWait):
p.Log.Infoln("MaxWait", "Items=", len(items))
if len(items) == 0 {
return
continue
}

items = p.releaseBatch(items)
Expand Down Expand Up @@ -132,4 +132,4 @@ func (p *BatchProducer) createBatchNo() {
// getBatchNo will get the current BatchNo from the atomic variable.
func (p *BatchProducer) getBatchNo() int32 {
return atomic.LoadInt32(&p.BatchNo)
}
}

0 comments on commit 7e509ac

Please sign in to comment.