sureshanaparti commented on code in PR #10417:
URL: https://github.com/apache/cloudstack/pull/10417#discussion_r1987185190


##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -834,11 +834,11 @@ private void 
retrieveSession(ManagementServerHostStatsEntry newEntry) {
         }
 
         private void getDataBaseStatistics(ManagementServerHostStatsEntry 
newEntry, long msid) {
-            newEntry.setLastAgents(_agentMgr.getLastAgents());
+            List<String> lastAgents = _hostDao.listByLastMs(msid);
+            newEntry.setLastAgents(lastAgents);
             List<String> agents = _hostDao.listByMs(msid);
             newEntry.setAgents(agents);
-            int count = _hostDao.countByMs(msid);
-            newEntry.setAgentCount(count);
+            newEntry.setAgentCount(agents.size());

Review Comment:
   to avoid another db call here (it does return the same count as agents)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to