Skip to content

Commit

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

(cherry picked from commit eb7a4f3)
(cherry picked from commit e729c90)
  • Loading branch information
thetumbled authored and nikhil-ctds committed Feb 19, 2025
1 parent d9553ae commit d1b73c1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,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 d1b73c1

Please sign in to comment.