You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/15 03:43:20 UTC

[GitHub] [pulsar] coderzc commented on a diff in pull request #17092: [improve][broker]: DelayedDeliveryTracker init and addMessage

coderzc commented on code in PR #17092:
URL: https://github.com/apache/pulsar/pull/17092#discussion_r945407900


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -111,8 +111,10 @@ public boolean addMessage(long ledgerId, long entryId, long deliverAt) {
         }
 
 
-        priorityQueue.add(deliverAt, ledgerId, entryId);
-        updateTimer();
+        synchronized (this) {

Review Comment:
   I think it is not thread-safe when only lock this scope because `highestDeliveryTimeTracked` and `messagesHaveFixedDelay` will still be modified concurrently.



-- 
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-unsubscribe@pulsar.apache.org

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