fix: use UTC time for fetch/import timer
1 file changed, 3 insertions(+), 4 deletions(-)
changed files
M searchix.go → searchix.go
@@ -13,11 +13,10 @@ "go.alanpearce.eu/searchix/internal/server" "go.alanpearce.eu/x/log" "github.com/getsentry/sentry-go" - "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" ) -func nextOccurrenceOfLocalTime(t toml.LocalTime) time.Time { +func nextUTCOccurrenceOfTime(t config.LocalTime) time.Time { now := time.Now() dayTime := t nextRun := time.Date(@@ -28,7 +27,7 @@ dayTime.Hour, dayTime.Minute, dayTime.Second, 0, - time.Local, + time.UTC, ) if nextRun.Before(now) { return nextRun.AddDate(0, 0, 1)@@ -170,7 +169,7 @@ Timezone: time.Local.String(), } s.wg.Add(1) - nextRun := nextOccurrenceOfLocalTime(s.cfg.Importer.UpdateAt.LocalTime) + nextRun := nextUTCOccurrenceOfTime(s.cfg.Importer.UpdateAt) for { s.log.Debug("scheduling next run", "next-run", nextRun) select {