add timezone support for cron scheduler

This commit is contained in:
ionutboangiu
2025-03-18 17:17:04 +02:00
committed by Dan Christian Bogos
parent adadcd01cb
commit de448ae11c

View File

@@ -48,7 +48,7 @@ func NewExporterMetrics(schedule, timezone string) (*ExporterMetrics, error) {
m.Reset() // init MapStorage with default values
if schedule != "" {
m.cron = cron.New()
m.cron = cron.New(cron.WithLocation(loc))
if _, err := m.cron.AddFunc(schedule, func() {
m.Reset()
}); err != nil {