From 9b723022436cc1a150af765103e8d343679f92ce Mon Sep 17 00:00:00 2001 From: Cong Zhao Date: Wed, 19 Apr 2023 16:44:12 +0800 Subject: [PATCH] [improve][broker] Make timer execute immediately after load index (#20126) --- .../delayed/bucket/BucketDelayedDeliveryTracker.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java index 6678c6df254b0..ad2fc6fae4c87 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java @@ -541,7 +541,7 @@ public long getBufferMemoryUsage() { @Override public synchronized NavigableSet getScheduledMessages(int maxMessages) { - if (!checkPendingOpDone()) { + if (!checkPendingLoadDone()) { if (log.isDebugEnabled()) { log.debug("[{}] Skip getScheduledMessages to wait for bucket snapshot load finish.", dispatcher.getName()); @@ -628,11 +628,11 @@ public synchronized NavigableSet getScheduledMessages(int maxMessa if (timeout != null) { timeout.cancel(); } - timeout = timer.newTimeout(this, tickTimeMillis, TimeUnit.MILLISECONDS); + timeout = timer.newTimeout(this, 0, TimeUnit.MILLISECONDS); } }); - if (!checkPendingOpDone() || loadFuture.isCompletedExceptionally()) { + if (!checkPendingLoadDone() || loadFuture.isCompletedExceptionally()) { break; } } @@ -651,7 +651,7 @@ public synchronized NavigableSet getScheduledMessages(int maxMessa return positions; } - private synchronized boolean checkPendingOpDone() { + private synchronized boolean checkPendingLoadDone() { if (pendingLoad == null || pendingLoad.isDone()) { pendingLoad = null; return true;