Skip to content

Commit

Permalink
[fix][test] fix flaky testNegativeAcksWithBackoff when batch enabled. (
Browse files Browse the repository at this point in the history
…#23986)

(cherry picked from commit eb7a4f3)
  • Loading branch information
thetumbled authored and lhotari committed Feb 17, 2025
1 parent b4b69c8 commit e729c90
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,16 @@ public void testNegativeAcksWithBackoff(boolean batching, boolean usePartitions,
long firstReceivedAt = System.currentTimeMillis();
long expectedTotalRedeliveryDelay = 0;
for (int i = 0; i < redeliverCount; i++) {
Message<String> msg = null;
for (int j = 0; j < N; j++) {
Message<String> msg = consumer.receive();
msg = consumer.receive();
log.info("Received message {}", msg.getValue());
if (!batching) {
consumer.negativeAcknowledge(msg);
}
}
if (batching) {
// for batching, we only need to nack one message in the batch to trigger redelivery
consumer.negativeAcknowledge(msg);
}
expectedTotalRedeliveryDelay += backoff.next(i);
Expand Down

0 comments on commit e729c90

Please sign in to comment.