m1a2st commented on code in PR #19868:
URL: https://github.com/apache/kafka/pull/19868#discussion_r2117942448


##########
core/src/test/scala/integration/kafka/api/AbstractConsumerTest.scala:
##########
@@ -94,12 +94,18 @@ abstract class AbstractConsumerTest extends BaseRequestTest 
{
   def awaitNonEmptyRecords[K, V](consumer: Consumer[K, V],
                                  partition: TopicPartition,
                                  pollTimeoutMs: Long = 100): 
ConsumerRecords[K, V] = {
+    var result: ConsumerRecords[K, V] = null
+
     TestUtils.pollRecordsUntilTrue(consumer, (polledRecords: 
ConsumerRecords[K, V]) => {
-      if (polledRecords.records(partition).asScala.nonEmpty)
-        return polledRecords
-      false
+      if (polledRecords.records(partition).asScala.nonEmpty) {
+        result = polledRecords
+        true
+      } else {
+        false
+      }

Review Comment:
   This part can be simplified.
   ```suggestion
         val hasRecords = !polledRecords.records(partition).isEmpty
         if (hasRecords) result = polledRecords
         hasRecords
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to