소스 검색

Do not wait for a full batch if there's no messages in the topic (#77)

Anton Petrov 5 년 전
부모
커밋
5ad3f5ce79
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/service/ConsumingService.java

+ 3 - 0
kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/service/ConsumingService.java

@@ -107,6 +107,9 @@ public class ConsumingService {
 				while (!sink.isCancelled() && ++pollsCount < MAX_POLLS_COUNT) {
 					ConsumerRecords<Bytes, Bytes> records = consumer.poll(POLL_TIMEOUT_MS);
 					log.info("{} records polled", records.count());
+					if (records.count() == 0) {
+						break;
+					}
 					records.iterator()
 							.forEachRemaining(sink::next);
 				}