RobertIndie commented on code in PR #71:
URL: https://github.com/apache/pulsar-client-cpp/pull/71#discussion_r1013556273


##########
lib/ConsumerImpl.cc:
##########
@@ -331,6 +371,13 @@ Optional<SharedBuffer> 
ConsumerImpl::processMessageChunk(const SharedBuffer& pay
                                                  << payload.readableBytes() << 
" bytes");
 
     Lock lock(chunkProcessMutex_);
+
+    // Lazy task scheduling to expire incomplete chunk message
+    if (!checkExpiredChunkedTimer_) {
+        checkExpiredChunkedTimer_ = executor_->createDeadlineTimer();
+        triggerCheckExpiredChunkedTimer();
+    }

Review Comment:
   The `checkExpiredChunkedTimer_ ` should always be not null in 
`triggerCheckExpiredChunkedTimer `; outside this method, we have always checked 
the null for it.
   If we go this way, we should always get the state of 
checkExpiredChunkedTimer_ here to check if the timer has been started to 
implement lazy scheduling. I haven't found a more elegant way to get the state. 
I think the current approach should be better.



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