Skip to content

Commit 2ea3251

Browse files
committed
sink: fix old bug determining whether more batches should be produced
The conditional was backwards... canLinger is true if we have lingering configured. What this meant: we we starting lingers with 0 duration that would immediately fire.
1 parent 309bff3 commit 2ea3251

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎pkg/kgo/sink.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ func (recBuf *recBuf) bufferRecord(pr promisedRec, abortOnNewBatch bool) bool {
14381438
// lingering, then we are flushing and also indicate there is more to drain.
14391439
func (recBuf *recBuf) tryStopLingerForDraining() bool {
14401440
recBuf.lockedStopLinger()
1441-
canLinger := recBuf.cl.cfg.linger == 0
1441+
canLinger := recBuf.cl.cfg.linger != 0
14421442
moreToDrain := !canLinger && len(recBuf.batches) > recBuf.batchDrainIdx ||
14431443
canLinger && (len(recBuf.batches) > recBuf.batchDrainIdx+1 ||
14441444
len(recBuf.batches) == recBuf.batchDrainIdx+1 && !recBuf.lockedMaybeStartLinger())

0 commit comments

Comments
 (0)