diff options
author | Alan Pearce | 2024-12-04 17:28:48 +0100 |
---|---|---|
committer | Alan Pearce | 2024-12-04 17:28:48 +0100 |
commit | c92530b7940bfd9e0940dd07e4a33b8dc4b575ea (patch) | |
tree | 465c3d05b2034e1a0c1daefcad2c645c79bfd90a /searchix.go | |
parent | ec4946ee959b2d7d28287e9cd4643a0698833f6b (diff) | |
download | searchix-c92530b7940bfd9e0940dd07e4a33b8dc4b575ea.tar.lz searchix-c92530b7940bfd9e0940dd07e4a33b8dc4b575ea.tar.zst searchix-c92530b7940bfd9e0940dd07e4a33b8dc4b575ea.zip |
fix: use UTC time for fetch/import timer
Diffstat (limited to 'searchix.go')
-rw-r--r-- | searchix.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/searchix.go b/searchix.go index 558847f..534624e 100644 --- a/searchix.go +++ b/searchix.go @@ -13,11 +13,10 @@ import ( "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 @@ func nextOccurrenceOfLocalTime(t toml.LocalTime) time.Time { dayTime.Minute, dayTime.Second, 0, - time.Local, + time.UTC, ) if nextRun.Before(now) { return nextRun.AddDate(0, 0, 1) @@ -170,7 +169,7 @@ func (s *Server) startUpdateTimer( } 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 { |