Skip to content

Commit

Permalink
Avoid warning logs on topic policies not present (#10785)
Browse files Browse the repository at this point in the history
  • Loading branch information
315157973 authored Jun 2, 2021
1 parent 045841e commit 707b3a4
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ public BacklogQuota getBacklogQuota(TopicName topicName) {
}

try {
return Optional.ofNullable(pulsar.getTopicPoliciesService().getTopicPolicies(topicName))
.map(TopicPolicies::getBackLogQuotaMap)
.map(map -> map.get(BacklogQuotaType.destination_storage.name()))
.orElseGet(() -> getBacklogQuota(topicName.getNamespace(), policyPath));
if (pulsar.getTopicPoliciesService().cacheIsInitialized(topicName)) {
return Optional.ofNullable(pulsar.getTopicPoliciesService().getTopicPolicies(topicName))
.map(TopicPolicies::getBackLogQuotaMap)
.map(map -> map.get(BacklogQuotaType.destination_storage.name()))
.orElseGet(() -> getBacklogQuota(topicName.getNamespace(), policyPath));
}
} catch (Exception e) {
log.warn("Failed to read topic policies data, will apply the namespace backlog quota: topicName={}",
topicName, e);
Expand Down

0 comments on commit 707b3a4

Please sign in to comment.