erobot commented on a change in pull request #10144:
URL: https://github.com/apache/pulsar/pull/10144#discussion_r607837748



##########
File path: pulsar-client-cpp/lib/ProducerImpl.cc
##########
@@ -255,12 +255,14 @@ std::shared_ptr<ProducerImpl::PendingCallbacks> 
ProducerImpl::getPendingCallback
     // without holding producer mutex.
     for (auto& op : pendingMessagesQueue_) {
         callbacks->opSendMsgs.push_back(op);
+        releaseSemaphoreForSendOp(op);
     }
 
     if (batchMessageContainer_) {
         OpSendMsg opSendMsg;
         if (batchMessageContainer_->createOpSendMsg(opSendMsg) == ResultOk) {
             callbacks->opSendMsgs.emplace_back(opSendMsg);
+            releaseSemaphoreForSendOp(opSendMsg);

Review comment:
       The memory is already reserved, so I think releaseSemaphoreForSendOp 
should be called  no matter batchMessageContainer_->createOpSendMsg() returns 
ok or not. (But this relys on that batchMessageContainer_->createOpSendMsg() 
sets opSendMsg correctly even if it returns failed. Although it does seem true 
this time.)




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

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


Reply via email to