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


##########
pulsar-client-cpp/lib/PartitionedConsumerImpl.cc:
##########
@@ -348,11 +329,12 @@ void 
PartitionedConsumerImpl::handleSinglePartitionConsumerClose(Result result,
     }
 }
 void PartitionedConsumerImpl::closeAsync(ResultCallback callback) {
+    Lock lock(mutex_);

Review Comment:
   We use `consumersMutex_` to protect `consumers_`.



##########
pulsar-client-cpp/lib/PartitionedConsumerImpl.cc:
##########
@@ -138,12 +126,10 @@ void 
PartitionedConsumerImpl::receiveAsync(ReceiveCallback& callback) {
 void PartitionedConsumerImpl::unsubscribeAsync(ResultCallback callback) {
     LOG_INFO("[" << topicName_->toString() << "," << subscriptionName_ << "] 
Unsubscribing");
     // change state to Closing, so that no Ready state operation is permitted 
during unsubscribe
-    setState(Closing);
+    state_ = Closing;
     // do not accept un subscribe until we have subscribe to all of the 
partitions of a topic
     // it's a logical single topic so it should behave like a single topic, 
even if it's sharded
-    Lock lock(mutex_);
     if (state_ != Ready) {

Review Comment:
   We don't need the `state_ != Ready` check here anymore.



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