Skip to content

Commit fbd9cfc

Browse files
committed
Fix Shutdown Race Causing Test Delays
Don't poll the consumer if the container has already stopped. This causes excessive test run times. Local build time reduced from 7 minutes to less than 5.
1 parent d60df68 commit fbd9cfc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,9 @@ protected void pollAndInvoke() {
10591059
}
10601060
pauseConsumerIfNecessary();
10611061
this.lastPoll = System.currentTimeMillis();
1062+
if (!isRunning()) {
1063+
return;
1064+
}
10621065
this.polling.set(true);
10631066
ConsumerRecords<K, V> records = doPoll();
10641067
if (!this.polling.compareAndSet(true, false) && records != null) {

0 commit comments

Comments
 (0)