Jason918 commented on code in PR #15295:
URL: https://github.com/apache/pulsar/pull/15295#discussion_r857356575


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java:
##########
@@ -157,7 +160,13 @@ public SubscribeRate getSubscribeRate() {
         return this.topicPolicies.getSubscribeRate().get();
     }
 
-    public DispatchRateImpl getSubscriptionDispatchRate() {
+    public DispatchRateImpl getSubscriptionDispatchRate(String 
subscriptionName) {
+        DispatchRateImpl rate = 
Optional.ofNullable(subscriptionPolicies.get(subscriptionName))
+                .map(SubscriptionPolicies::getDispatchRate).orElse(null);
+        rate = DispatchRateImpl.normalize(rate);

Review Comment:
   `DispatchRateImpl` don't have concept of `empty`. `normalize` can handle the 
case when rate is `null`.



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

Reply via email to