MarvinCai commented on a change in pull request #7863:
URL: https://github.com/apache/pulsar/pull/7863#discussion_r475149695



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -2343,6 +2347,34 @@ public int getMaxUnackedMessagesOnSubscription() {
         return maxUnackedMessagesOnSubscription;
     }
 
+    @Override
+    public void onUpdate(TopicPolicies policies) {
+        if (log.isDebugEnabled()) {
+            log.debug("[{}] update topic policy: {}", topic, policies);
+        }
+
+        
initializeTopicDispatchRateLimiterIfNeeded(Optional.ofNullable(policies));
+        if (this.dispatchRateLimiter.isPresent() && policies != null
+                && policies.getDispatchRate() != null) {
+            dispatchRateLimiter.ifPresent(dispatchRateLimiter ->
+                
dispatchRateLimiter.updateDispatchRate(policies.getDispatchRate()));
+        }
+    }
+
+    private void 
initializeTopicDispatchRateLimiterIfNeeded(Optional<TopicPolicies> policies) {

Review comment:
       minor: probably updateXXIfNeeded would be better 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to