enhance hourly snapshots
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user