Skip to content

Commit

Permalink
[fix][broker] Remove blocking calls from internalGetPartitionedStats
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
nodece committed Jan 9, 2025
1 parent 9149720 commit c33b7da
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1522,21 +1522,18 @@ 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;
}
return 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"));
}
});
}
asyncResponse.resume(stats);
return null;
Expand Down

0 comments on commit c33b7da

Please sign in to comment.