MINOR: Ensure consumer calls poll() if requests are outstanding
Author: Jason Gustafson
Reviewers: Onur Karaman Ismael Juma
Closes from hachikuji/ensure-poll-with-inflight-requests
@@ -1000,9 +1000,8 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
//
// NOTE: since the consumed position has already been updated, we must not allow
// wakeups or any other errors to be triggered prior to returning the fetched records.
- if (fetcher.sendFetches() > 0) {
+ if (fetcher.sendFetches() > 0 || client.pendingRequestCount() > 0)
client.pollNoWakeup();
- }
if (this.interceptors == null)
return new ConsumerRecords<>(records);
