Skip to content

Commit 9b72302

Browse files
authored
[improve][broker] Make timer execute immediately after load index (apache#20126)
1 parent 866d405 commit 9b72302

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ public long getBufferMemoryUsage() {
541541

542542
@Override
543543
public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessages) {
544-
if (!checkPendingOpDone()) {
544+
if (!checkPendingLoadDone()) {
545545
if (log.isDebugEnabled()) {
546546
log.debug("[{}] Skip getScheduledMessages to wait for bucket snapshot load finish.",
547547
dispatcher.getName());
@@ -628,11 +628,11 @@ public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessa
628628
if (timeout != null) {
629629
timeout.cancel();
630630
}
631-
timeout = timer.newTimeout(this, tickTimeMillis, TimeUnit.MILLISECONDS);
631+
timeout = timer.newTimeout(this, 0, TimeUnit.MILLISECONDS);
632632
}
633633
});
634634

635-
if (!checkPendingOpDone() || loadFuture.isCompletedExceptionally()) {
635+
if (!checkPendingLoadDone() || loadFuture.isCompletedExceptionally()) {
636636
break;
637637
}
638638
}
@@ -651,7 +651,7 @@ public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessa
651651
return positions;
652652
}
653653

654-
private synchronized boolean checkPendingOpDone() {
654+
private synchronized boolean checkPendingLoadDone() {
655655
if (pendingLoad == null || pendingLoad.isDone()) {
656656
pendingLoad = null;
657657
return true;

0 commit comments

Comments
 (0)