dao-jun commented on code in PR #24658: URL: https://github.com/apache/pulsar/pull/24658#discussion_r2297080175
########## pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java: ########## @@ -473,15 +478,16 @@ public boolean test(NamespaceBundle namespaceBundle) { private void initPolicesCache(SystemTopicClient.Reader<PulsarEvent> reader, CompletableFuture<Void> future) { if (closed.get()) { future.completeExceptionally(new BrokerServiceException(getClass().getName() + " is closed.")); - cleanCacheAndCloseReader(reader.getSystemTopic().getTopicName().getNamespaceObject(), false); + cleanCache(reader.getSystemTopic().getTopicName().getNamespaceObject(), false, true); return; } reader.hasMoreEventsAsync().whenComplete((hasMore, ex) -> { if (ex != null) { log.error("[{}] Failed to check the move events for the system topic", reader.getSystemTopic().getTopicName(), ex); future.completeExceptionally(ex); - cleanCacheAndCloseReader(reader.getSystemTopic().getTopicName().getNamespaceObject(), false); + cleanCache(reader.getSystemTopic().getTopicName().getNamespaceObject(), false, + isAlreadyClosedException(ex)); Review Comment: It is makes sense to refactor the method, may I improve it with a split PR? just make this PR well scoped. @BewareMyPower -- 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-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org