DaanHoogland commented on code in PR #10492:
URL: https://github.com/apache/cloudstack/pull/10492#discussion_r1979094513
##########
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));
Review Comment:
clgtm, as in this will avoid the NPE, but should we add avalue of 0 at all
in this case? It seems to me that uptime - lastUptime == 0, we have another
problem and should not add a value.
--
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]