You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/28 13:01:12 UTC

[GitHub] [pulsar] Technoboy- commented on a diff in pull request #16221: [improve][broker][PIP-149]Make getList async

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -4251,8 +4243,16 @@ private RestException topicNotFoundReason(TopicName topicName) {
                     == null ? "has no metadata" : "has zero partitions";
             return new RestException(Status.NOT_FOUND, String.format(
                     "Partitioned Topic not found: %s %s", topicName.toString(), topicErrorType));
-        } else if (!internalGetList(Optional.empty()).contains(topicName.toString())) {
-            return new RestException(Status.NOT_FOUND, "Topic partitions were not yet created");
+        } else {
+            try {
+                if (!internalGetListAsync(Optional.empty())
+                    .get(pulsar().getConfiguration().getMetadataStoreOperationTimeoutSeconds(), TimeUnit.SECONDS)
+                    .contains(topicName.toString())) {
+                    return new RestException(Status.NOT_FOUND, "Topic partitions were not yet created");
+                }
+            } catch (Exception e) {
+                // failed to get reason, so fall through coarse reason

Review Comment:
   I think you can add a new sync method called `internalGetList` like `getPartitionedTopicMetadata`.



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