Technoboy- commented on code in PR #18804:
URL: https://github.com/apache/pulsar/pull/18804#discussion_r1043097511


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -106,6 +109,19 @@ private CompletableFuture<Void> 
sendTopicPolicyEvent(TopicName topicName, Action
                     new BrokerServiceException.NotAllowedException("Not 
allowed to send event to health check topic"));
         }
         CompletableFuture<Void> result = new CompletableFuture<>();
+        try {
+            final Optional<Policies> namespacePolicies = 
pulsarService.getPulsarResources().getNamespaceResources()
+                    .getPolicies(topicName.getNamespaceObject());
+            if (namespacePolicies.isPresent() && 
namespacePolicies.get().deleted) {
+                log.debug("[{}] skip sending topic policy event since the 
namespace is deleted", topicName);
+                result.complete(null);
+                return result;
+            }
+        } catch (MetadataStoreException e) {
+            result.completeExceptionally(e);
+            return result;
+        }
+

Review Comment:
   It's better to call the async method `getPoliciesAsync`



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