fix daily aggregation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nathan Coad
2026-01-22 10:20:18 +11:00
parent 0a2c529111
commit 148df38219

View File

@@ -24,7 +24,8 @@ func (c *CronTask) RunVcenterDailyAggregate(ctx context.Context, logger *slog.Lo
defer func() { defer func() {
logger.Info("Daily summary job finished", "duration", time.Since(startedAt)) logger.Info("Daily summary job finished", "duration", time.Since(startedAt))
}() }()
targetTime := time.Now().Add(-time.Minute) // Aggregate the previous day to avoid partial "today" data when the job runs just after midnight.
targetTime := time.Now().AddDate(0, 0, -1)
// Always force regeneration on the scheduled run to refresh data even if a manual run happened earlier. // Always force regeneration on the scheduled run to refresh data even if a manual run happened earlier.
return c.aggregateDailySummary(jobCtx, targetTime, true) return c.aggregateDailySummary(jobCtx, targetTime, true)
}) })