AnonHxy commented on code in PR #21030:
URL: https://github.com/apache/pulsar/pull/21030#discussion_r1299736321


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -420,11 +427,26 @@ private void cleanCacheAndCloseReader(@Nonnull 
NamespaceName namespace, boolean
         });
     }
 
+    private void completeResults(TopicName topicName) {
+        if (results.get(topicName) != null) {
+            BlockingDeque<CompletableFuture> futures = results.get(topicName);
+            CompletableFuture<Void> future;
+            while (true) {
+                future = futures.poll();
+                if (future == null) {
+                    break;
+                }
+                future.complete(null);
+            }
+        }
+    }
+
     private void readMorePolicies(SystemTopicClient.Reader<PulsarEvent> 
reader) {
         reader.readNextAsync()
                 .thenAccept(msg -> {
                     refreshTopicPoliciesCache(msg);
                     notifyListener(msg);
+                    
completeResults(TopicName.get(TopicName.get(msg.getKey()).getPartitionedTopicName()));

Review Comment:
   OK. I see. Synchronize case is enough I think



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