From 7e509ac5f348535b5ca2da3aa913dbadd4fa4861 Mon Sep 17 00:00:00 2001 From: Stefan Blum <40357203+DerBlum@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:24:13 +0100 Subject: [PATCH] Fix MaxWait only configuration Don't quit when no Items are present after MaxWait passes. Instead, continue and wait for MaxItems or MaxWait to be reached again. --- producer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/producer.go b/producer.go index 18695a4..96e0a08 100644 --- a/producer.go +++ b/producer.go @@ -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) @@ -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) -} \ No newline at end of file +}