thetumbled commented on code in PR #24430:
URL: https://github.com/apache/pulsar/pull/24430#discussion_r2158463078
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -221,14 +230,13 @@ public NavigableSet<Position> getScheduledMessages(int
maxMessages) {
@Override
public CompletableFuture<Void> clear() {
this.delayedMessageMap.clear();
+ this.delayedMessagesCount.set(0);
return CompletableFuture.completedFuture(null);
}
@Override
public long getNumberOfDelayedMessages() {
- return delayedMessageMap.values().stream().mapToLong(
- ledgerMap -> ledgerMap.values().stream().mapToLong(
- Roaring64Bitmap::getLongCardinality).sum()).sum();
+ return delayedMessagesCount.get();
Review Comment:
There are some tests that directly call this method:
<img width="744" alt="image"
src="https://github.com/user-attachments/assets/6580cd6b-d23a-43dd-9698-c9605b0e039b"
/>
Each time we add a delay message or retrieve a delay message, this method
will be called indirectly, which underscores the importance of an efficient
approach.
Therefore, I believe there is sufficient test coverage for this method.
--
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]