BewareMyPower commented on code in PR #16969:
URL: https://github.com/apache/pulsar/pull/16969#discussion_r954736387


##########
pulsar-client-cpp/lib/MultiTopicsConsumerImpl.cc:
##########
@@ -125,33 +133,39 @@ Future<Result, Consumer> 
MultiTopicsConsumerImpl::subscribeOneTopicAsync(const s
     }
 
     // subscribe for each partition, when all partitions completed, complete 
promise
-    
lookupServicePtr_->getPartitionMetadataAsync(topicName).addListener(std::bind(
-        &MultiTopicsConsumerImpl::subscribeTopicPartitions, 
shared_from_this(), std::placeholders::_1,
-        std::placeholders::_2, topicName, subscriptionName_, conf_, 
topicPromise));
+    Lock lock(mutex_);
+    auto entry = topicsPartitions_.find(topic);
+    if (entry == topicsPartitions_.end()) {
+        lock.unlock();
+        lookupServicePtr_->getPartitionMetadataAsync(topicName).addListener(
+            [this, topicName, topicPromise](const Result result, const 
LookupDataResultPtr lookupDataResult) {

Review Comment:
   ```suggestion
               [this, topicName, topicPromise](Result result, const 
LookupDataResultPtr& lookupDataResult) {
   ```
   
   The listener's function signature is `std::function<Result, const T&>`.



-- 
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