DaanHoogland commented on code in PR #10492:
URL: https://github.com/apache/cloudstack/pull/10492#discussion_r1979639021


##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -718,7 +718,7 @@ protected void runInContext() {
                  getDynamicDataFromDB();
                  long interval = (Long) dbStats.get(uptime) - lastUptime;
                  long activity = (Long) dbStats.get(queries) - lastQueries;
-                 loadHistory.add(0, Double.valueOf(activity / interval));
+                 loadHistory.add(0, interval == 0 ? 0 : 
Double.valueOf(activity / interval));
                  int maxsize = 
DATABASE_SERVER_LOAD_HISTORY_RETENTION_NUMBER.value();
                  while (loadHistory.size() > maxsize) {
                      loadHistory.remove(maxsize - 1);

Review Comment:
   additional bug @lucas-a-martins : it should delete any item beyond maxsize 
not maxsize -1
   if you can take this in?
   ```suggestion
                        loadHistory.remove(maxsize);
   ```



-- 
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