You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/02/04 22:57:24 UTC

[GitHub] lovelle commented on a change in pull request #3521: Use testDupConsumersOnSharedModeNotThrowsExcOnUnsubscribe to avoid interference with other tests running in parallel

lovelle commented on a change in pull request #3521: Use testDupConsumersOnSharedModeNotThrowsExcOnUnsubscribe to avoid interference with other tests running in parallel
URL: https://github.com/apache/pulsar/pull/3521#discussion_r253680002
 
 

 ##########
 File path: pulsar-client-cpp/lib/ClientImpl.cc
 ##########
 @@ -342,10 +342,11 @@ void ClientImpl::subscribeAsync(const std::string& topic, const std::string& con
             return;
         } else if (conf.getConsumerType() == ConsumerShared) {
             ConsumersList consumers(consumers_);
-            for (ConsumersList::iterator it = consumers.begin(); it != consumers.end(); ++it) {
-                ConsumerImplBasePtr consumer = it->lock();
+            for (auto& weakPtr : consumers) {
+                ConsumerImplBasePtr consumer = weakPtr.lock();
                 if (consumer && consumer->getSubscriptionName() == consumerName && !consumer->isClosed()) {
                     lock.unlock();
+                    LOG_INFO("Reusing existing consumer instance for " << topic << " -- " << consumerName);
 
 Review comment:
   Maybe a `warn` would be better to alert the user of a miss use?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services