avoid vcenter totals pages scanning whole database
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2026-02-09 13:44:43 +11:00
parent c66679a71f
commit 5736dc6929
11 changed files with 991 additions and 195 deletions

View File

@@ -182,6 +182,11 @@ func (c *CronTask) aggregateDailySummary(ctx context.Context, targetTime time.Ti
} else {
c.Logger.Debug("Registered daily snapshot", "table", summaryTable, "duration", time.Since(registerStart))
}
if refreshed, err := db.ReplaceVcenterAggregateTotalsFromSummary(ctx, dbConn, summaryTable, "daily", dayStart.Unix()); err != nil {
c.Logger.Warn("failed to refresh vcenter daily aggregate totals cache", "error", err, "table", summaryTable)
} else {
c.Logger.Debug("refreshed vcenter daily aggregate totals cache", "table", summaryTable, "rows", refreshed)
}
reportStart := time.Now()
c.Logger.Debug("Generating daily report", "table", summaryTable)
@@ -432,6 +437,11 @@ LIMIT 1
} else {
c.Logger.Debug("Registered daily snapshot", "table", summaryTable, "duration", time.Since(registerStart))
}
if refreshed, err := db.ReplaceVcenterAggregateTotalsFromSummary(ctx, dbConn, summaryTable, "daily", dayStart.Unix()); err != nil {
c.Logger.Warn("failed to refresh vcenter daily aggregate totals cache", "error", err, "table", summaryTable)
} else {
c.Logger.Debug("refreshed vcenter daily aggregate totals cache", "table", summaryTable, "rows", refreshed)
}
reportStart := time.Now()
c.Logger.Debug("Generating daily report", "table", summaryTable)
if err := c.generateReport(ctx, summaryTable); err != nil {