CQ current interval start time calculated wrong
When a CQ is run, the start time of the current interval is:
interval, err := cq.q.GroupByInterval()
startTime := now.Round(interval)
Half way through an interval, the current interval gets rounded up (into the future) to the next interval. It should use now.Truncate(interval) instead.
Hi @dgnorton , I think the start time calculated is right. After startTime := now.Round(interval), the following code is
if startTime.UnixNano() > now.UnixNano() {
startTime = startTime.Add(-interval)
}
That can get the same result with now.Truncate(interval), but the now.Truncate(interval) is more simple and clear.
@li-ang truncating gives a different result because it will align with an interval boundary. now - interval shifts the starting point so that it's not in the future but it may not be aligned with an interval boundary.