poorbarcode commented on code in PR #20075:
URL: https://github.com/apache/pulsar/pull/20075#discussion_r1163793192


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -1101,9 +1101,13 @@ public CompletableFuture<Void> clearDelayedMessages() {
         if (delayedDeliveryTracker.isEmpty() && topic.getBrokerService()
                 .getDelayedDeliveryTrackerFactory() instanceof 
BucketDelayedDeliveryTrackerFactory) {
             synchronized (this) {
-                if (delayedDeliveryTracker.isEmpty()) {
-                    delayedDeliveryTracker = Optional
-                            
.of(topic.getBrokerService().getDelayedDeliveryTrackerFactory().newTracker(this));
+                try {
+                    if (delayedDeliveryTracker.isEmpty()) {
+                        delayedDeliveryTracker = Optional
+                                
.of(topic.getBrokerService().getDelayedDeliveryTrackerFactory().newTracker(this));

Review Comment:
   If we never touch the method `trackDelayedDelivery()`, then the variable 
`delayedDeliveryTracker` is always is `empty`, right? 
   
   If yes, why need we initialize it when we should clear delayed messages? Can 
we just return a completed future?



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