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



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/DispatchRateLimiter.java
##########
@@ -324,18 +320,12 @@ public DispatchRate getPoliciesDispatchRate(BrokerService 
brokerService) {
 
     public static Optional<Policies> getPolicies(BrokerService brokerService, 
String topicName) {
         final NamespaceName namespace = 
TopicName.get(topicName).getNamespaceObject();
-        final String path = path(POLICIES, namespace.toString());
-        Optional<Policies> policies = Optional.empty();
         try {
-            ConfigurationCacheService configurationCacheService = 
brokerService.pulsar().getConfigurationCache();
-            if (configurationCacheService != null) {
-                policies = 
configurationCacheService.policiesCache().getAsync(path)
-                        
.get(brokerService.pulsar().getConfiguration().getZooKeeperOperationTimeoutSeconds(),
 SECONDS);
-            }
+            return 
brokerService.pulsar().getPulsarResources().getNamespaceResources().getPolicies(namespace);
         } catch (Exception e) {
             log.warn("Failed to get message-rate for {} ", topicName, e);
+            return Optional.empty();

Review comment:
       I know it's bad but I didn't want to get sidetracked since it's already 
a big PR :) 




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