Phuc-Hong-Tran commented on code in PR #15585: URL: https://github.com/apache/kafka/pull/15585#discussion_r1540153302
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -1750,8 +1753,14 @@ private void subscribeInternal(Pattern pattern, Optional<ConsumerRebalanceListen throwIfNoAssignorsConfigured(); log.info("Subscribed to pattern: '{}'", pattern); subscriptions.subscribe(pattern, listener); - updatePatternSubscription(metadata.fetch()); metadata.requestUpdateForNewTopics(); + Cluster cache = metadata.fetch(); + + while (cache == metadata.fetch()) { + log.info("Waiting for new metadata update"); + } Review Comment: @lianetm Please correct me if I'm wrong, isn't by default the `metadata.fetch()` doesn't return a null? With this assumption there will always be a Cluster object at the beginning of the while loop, and once we're out of the loop we will have a newly updated metadata, since there is a call for `requestUpdateForNewTopics` before this loop -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org