Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #8196] Return count number of subscribers correctly when throw an exception #8197

Merged
merged 1 commit into from Apr 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -342,6 +342,8 @@ public ObjectNode subscribers(HttpServletRequest request) {

ObjectNode result = JacksonUtils.createEmptyJsonNode();

int count = 0;

try {
List<Subscriber> subscribers = subscribeManager.getSubscribers(serviceName, namespaceId, aggregation);

Expand All @@ -351,7 +353,7 @@ public ObjectNode subscribers(HttpServletRequest request) {
}

int end = start + pageSize;
int count = subscribers.size();
count = subscribers.size();
if (end > count) {
end = count;
}
Expand All @@ -363,7 +365,7 @@ public ObjectNode subscribers(HttpServletRequest request) {
} catch (Exception e) {
Loggers.SRV_LOG.warn("query subscribers failed!", e);
result.replace("subscribers", JacksonUtils.createEmptyArrayNode());
result.put("count", 0);
result.put("count", count);
return result;
}
}
Expand Down