lhotari commented on code in PR #15132:
URL: https://github.com/apache/pulsar/pull/15132#discussion_r850094656
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -447,10 +442,12 @@ public void publishMessage(ByteBuf headersAndPayload,
PublishContext publishCont
public void updateSubscribeRateLimiter() {
SubscribeRate subscribeRate = this.getSubscribeRate();
- if (isSubscribeRateEnabled(subscribeRate)) {
- subscribeRateLimiter = Optional.of(subscribeRateLimiter.orElse(new
SubscribeRateLimiter(this)));
- } else {
- subscribeRateLimiter = Optional.empty();
+ synchronized (subscribeRateLimiter) {
Review Comment:
`synchronized(subscribeRateLimiter)` seems wrong. I can now see that this
came from the original code. This should be fixed.
One possible fix is to make the `subscribeRateLimiter` field a `volatile`
field.
--
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]