arhoads commented on code in PR #497:
URL: https://github.com/apache/pulsar-client-cpp/pull/497#discussion_r2274220029


##########
lib/NegativeAcksTracker.cc:
##########
@@ -75,13 +81,22 @@ void NegativeAcksTracker::handleTimer(const ASIO_ERROR &ec) 
{
 
     auto now = Clock::now();
 
+    // The map is sorted by time, so we can exit immediately when we traverse 
to a time that does not match
     for (auto it = nackedMessages_.begin(); it != nackedMessages_.end();) {
-        if (it->second < now) {
-            messagesToRedeliver.insert(it->first);
-            it = nackedMessages_.erase(it);
-        } else {
-            ++it;
+        if (it->first > now) {
+            // We are done with all the messages that need to be redelivered
+            break;
         }
+
+        auto ledgerMap = it->second;
+        for (auto ledgerIt = ledgerMap.begin(); ledgerIt != ledgerMap.end(); 
++ledgerIt) {
+            auto entrySet = ledgerIt->second;

Review Comment:
   This makes a copy. Is this intended to be a reference instead - `auto& 
entrySet = ledgerIt->second;`?



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to