nodece commented on code in PR #23930:
URL: https://github.com/apache/pulsar/pull/23930#discussion_r1947494686
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/qos/AsyncTokenBucket.java:
##########
@@ -177,8 +186,13 @@ private long consumeTokensAndMaybeUpdateTokensBalance(long
consumeTokens, boolea
pendingConsumedTokens.add(consumeTokens);
}
- // return Long.MIN_VALUE if the current value of tokens is unknown
due to the eventual consistency
- return Long.MIN_VALUE;
+ if (forceUpdateTokens) {
+ // return the current tokens balance without updating the
tokens and resetting the pendingConsumedTokens
+ return tokens - pendingConsumedTokens.sum();
Review Comment:
```suggestion
return tokens - pendingConsumedTokens.sumThenReset();
```
> resetting the pendingConsumedTokens
Should be `sumThenReset()`?
--
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]