merlimat commented on a change in pull request #10683:
URL: https://github.com/apache/pulsar/pull/10683#discussion_r637565468



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/SubscribeRateLimiter.java
##########
@@ -51,7 +51,7 @@ public SubscribeRateLimiter(PersistentTopic topic) {
         subscribeRateLimiter = new ConcurrentHashMap<>();
         this.executorService = brokerService.pulsar().getExecutor();
         // get subscribeRate from topic level policies
-        this.subscribeRate = 
Optional.ofNullable(brokerService.getTopicPolicies(TopicName.get(this.topicName)))
+        this.subscribeRate = Optional.ofNullable(topic.getTopicPolicies())

Review comment:
       Rather than returning null and having downstream user having to check 
for that, it would be better to return `Optional<Policies>` directly.




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