RobertIndie commented on code in PR #16943:
URL: https://github.com/apache/pulsar/pull/16943#discussion_r951112751


##########
pulsar-client-cpp/lib/ConsumerImpl.cc:
##########
@@ -1326,8 +1336,26 @@ void 
ConsumerImpl::getLastMessageIdAsync(BrokerGetLastMessageIdCallback callback
             callback(ResultUnsupportedVersionError, MessageId());
         }
     } else {
-        LOG_ERROR(getName() << " Client Connection not ready for Consumer");
-        callback(ResultNotConnected, MessageId());
+        TimeDuration next = std::min(remainTime, backoff->next());
+        if (next.total_milliseconds() <= 0) {
+            LOG_ERROR(getName() << " Client Connection not ready for 
Consumer");
+            callback(ResultNotConnected, MessageId());
+            return;
+        }
+        remainTime -= next;
+
+        timer->expires_from_now(next);
+
+        timer->async_wait([this, backoff, remainTime, timer, next,
+                           callback](const boost::system::error_code& ec) -> 
void {

Review Comment:
   Looks like there is a similar problem in the current codes. 
https://github.com/apache/pulsar/blob/c4bd7ae15a1e37075fb5a0b3b4636591ed2462c8/pulsar-client-cpp/lib/AckGroupingTrackerEnabled.cc#L153-L158
   
   Could you guide me on how to capture `shared_from_this()`? I haven't found a 
good way to solve it. 



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