Skip to content

Commit

Permalink
[fix][broker] Remove blocking calls from internalGetPartitionedStats (#…
Browse files Browse the repository at this point in the history
…23832)

Signed-off-by: Zixuan Liu <[email protected]>
(cherry picked from commit dc63970)
  • Loading branch information
nodece committed Jan 14, 2025
1 parent 8181177 commit 85a0f79
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1597,23 +1597,21 @@ protected void internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
}
}
if (perPartition && stats.partitions.isEmpty()) {
try {
boolean pathExists = namespaceResources().getPartitionedTopicResources()
.partitionedTopicExists(topicName);
if (pathExists) {
stats.partitions.put(topicName.toString(), new TopicStatsImpl());
} else {
asyncResponse.resume(
new RestException(Status.NOT_FOUND,
"Internal topics have not been generated yet"));
return null;
}
} catch (Exception e) {
asyncResponse.resume(new RestException(e));
return null;
}
namespaceResources().getPartitionedTopicResources()
.partitionedTopicExistsAsync(topicName)
.thenAccept(exists -> {
if (exists) {
stats.partitions.put(topicName.toString(), new TopicStatsImpl());
asyncResponse.resume(stats);
} else {
asyncResponse.resume(
new RestException(Status.NOT_FOUND,
"Internal topics have not been generated yet"));
}
});
} else {
asyncResponse.resume(stats);
}
asyncResponse.resume(stats);
return null;
});
}).exceptionally(ex -> {
Expand Down

0 comments on commit 85a0f79

Please sign in to comment.