Skip to content

Commit

Permalink
[ISSUE alibaba#8196] Return count number of subscribers correctly whe…
Browse files Browse the repository at this point in the history
…n throw an exception (alibaba#8197)

Close alibaba#8196
  • Loading branch information
onewe authored Apr 18, 2022
1 parent 44850cc commit 8401b8c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
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

0 comments on commit 8401b8c

Please sign in to comment.