You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "mattisonchao (via GitHub)" <gi...@apache.org> on 2023/06/25 02:38:55 UTC

[GitHub] [pulsar] mattisonchao commented on a diff in pull request #20613: [fix][broker] Topic policy can not be work well if replay policy message has any exception.

mattisonchao commented on code in PR #20613:
URL: https://github.com/apache/pulsar/pull/20613#discussion_r1241005146


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -362,13 +362,20 @@ private void initPolicesCache(SystemTopicClient.Reader<PulsarEvent> reader, Comp
                 policyCacheInitMap.computeIfPresent(
                         reader.getSystemTopic().getTopicName().getNamespaceObject(), (k, v) -> true);
                 // replay policy message
-                policiesCache.forEach(((topicName, topicPolicies) -> {
-                    if (listeners.get(topicName) != null) {
-                        for (TopicPolicyListener<TopicPolicies> listener : listeners.get(topicName)) {
-                            listener.onUpdate(topicPolicies);
+                try {
+                    policiesCache.forEach(((topicName, topicPolicies) -> {
+                        if (listeners.get(topicName) != null) {
+                            for (TopicPolicyListener<TopicPolicies> listener : listeners.get(topicName)) {
+                                listener.onUpdate(topicPolicies);

Review Comment:
   Can we easily catch the `onUpdate` method's exception with the warn log and then normally complete the future? 
   
   IMO, Because it is an implementation problem(bug) in the listener logic, we can't let one bad apple spoils the whole bunch. :) 
   



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org