enhance hourly snapshots
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-14 16:09:13 +11:00
parent 417c7c8127
commit 44ae2094f3
2 changed files with 7 additions and 7 deletions

View File

@@ -94,22 +94,21 @@ func (c *CronTask) RunVcenterSnapshotHourly(ctx context.Context, logger *slog.Lo
if concurrencyLimit > 0 {
sem = make(chan struct{}, concurrencyLimit)
}
c.Logger.Info("Starting hourly snapshots", "vcenter_count", len(c.Settings.Values.Settings.VcenterAddresses), "concurrency_limit", concurrencyLimit)
for _, url := range c.Settings.Values.Settings.VcenterAddresses {
url := url
if sem != nil {
sem <- struct{}{}
}
wg.Add(1)
go func() {
go func(url string) {
defer wg.Done()
if sem != nil {
sem <- struct{}{}
defer func() { <-sem }()
}
c.Logger.Info("Starting hourly snapshot for vcenter", "url", url)
if err := c.captureHourlySnapshotForVcenter(ctx, startTime, tableName, url); err != nil {
atomic.AddInt64(&errCount, 1)
c.Logger.Error("hourly snapshot failed", "error", err, "url", url)
}
}()
}(url)
}
wg.Wait()
if errCount > 0 {