BryanMLima commented on code in PR #8581:
URL: https://github.com/apache/cloudstack/pull/8581#discussion_r1639785664
##########
usage/src/main/java/com/cloud/usage/UsageManagerImpl.java:
##########
@@ -405,9 +405,14 @@ protected void runInContextInternal() {
cal.add(Calendar.MILLISECOND, -1);
endDate = cal.getTime().getTime();
} else {
- endDate = cal.getTime().getTime(); // current time
cal.add(Calendar.MINUTE, -1 * _aggregationDuration);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
startDate = cal.getTime().getTime();
+
+ cal.add(Calendar.MINUTE, _aggregationDuration);
+ cal.add(Calendar.MILLISECOND, -1);
+ endDate = cal.getTime().getTime();
Review Comment:
@GutoVeronezi, sorry for the delayed response. The interval will always be
between a range X and X - 1 milliseconds. Previously, when setting the
aggregation time different from per day or per hour, the Quota calculation
would consider duplicate entries between intervals (e.g. with an interval of 2
days, the Quota would process the same entries that were at the end of the
previous aggregation and at the start of the next aggregation interval). This
PR fixes this issue, keeping all types of aggregation intervals consistent.
--
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]