Don't delay batch offset commits
When `idleBetweenPolls` was set, the sleep was done after invoking the listener and before calling `pollAndInvoke()` again. This delays committing the offsets for ack modes other than `RECORD`. Move the sleep to after committing the offsets and before the next `poll()`.
This commit is contained in:
committed by
Artem Bilan
parent
1cd3ebfa3a
commit
eccfb4c850
@@ -888,7 +888,6 @@ public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
|
||||
while (isRunning()) {
|
||||
try {
|
||||
pollAndInvoke();
|
||||
idleBetweenPollIfNecessary();
|
||||
}
|
||||
catch (@SuppressWarnings(UNUSED) WakeupException e) {
|
||||
// Ignore, we're stopping or applying immediate foreign acks
|
||||
@@ -929,6 +928,7 @@ public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
|
||||
if (!this.autoCommit && !this.isRecordAck) {
|
||||
processCommits();
|
||||
}
|
||||
idleBetweenPollIfNecessary();
|
||||
if (this.seeks.size() > 0) {
|
||||
processSeeks();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user