diff options
-rw-r--r-- | CHANGELOG.md | 15 | ||||
-rw-r--r-- | defaults.toml | 4 | ||||
-rw-r--r-- | internal/config/default.go | 2 | ||||
-rw-r--r-- | internal/config/structs.go | 2 | ||||
-rw-r--r-- | justfile | 3 | ||||
-rw-r--r-- | nix/modules/default.nix | 2 | ||||
-rw-r--r-- | nix/package.nix | 2 | ||||
-rw-r--r-- | searchix.go | 7 |
8 files changed, 25 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d2254b..3ec5cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,19 @@ # Changelog -## [v0.1.11](https://git.alanpearce.eu/searchix/diff/?id=v0.1.10&id2=v0.1.11) (2024-11-20) +## [v0.1.12](https://git.alanpearce.eu/searchix/diff/?id=v0.1.11&id2=v0.1.12) (2024-12-04) -### Features +### Fixes + +- use UTC time for fetch/import timer + ([c92530b](https://git.alanpearce.eu/searchix/commit/?id=c92530b7940bfd9e0940dd07e4a33b8dc4b575ea)) +- enable using module in pure evaluation mode + ([ec4946e](https://git.alanpearce.eu/searchix/commit/?id=ec4946ee959b2d7d28287e9cd4643a0698833f6b)) +- enable using module in pure evaluation mode + ([174ad04](https://git.alanpearce.eu/searchix/commit/?id=174ad04905da9709e4aef366e14aa438e58e5b0b)) + +### [v0.1.11](https://git.alanpearce.eu/searchix/diff/?id=v0.1.10&id2=v0.1.11) (2024-11-20) + +#### Features - apply stemming to search index terms ([72d56a6](https://git.alanpearce.eu/searchix/commit/?id=72d56a6781e97cde13ba068e8553e9342bd1fa20)) diff --git a/defaults.toml b/defaults.toml index 66f0d07..4f95929 100644 --- a/defaults.toml +++ b/defaults.toml @@ -64,8 +64,8 @@ x-frame-options = 'DENY' LowMemory = false # Abort fetch and import process for all jobs if it takes longer than this value. Timeout = '30m0s' -# Local time of day to run fetch/import process -UpdateAt = '04:00:00' +# Time of day (UTC) to run fetch/import process +UpdateAt = '03:00:00' [Importer.Sources] [Importer.Sources.darwin] diff --git a/internal/config/default.go b/internal/config/default.go index d6ad6f7..a857799 100644 --- a/internal/config/default.go +++ b/internal/config/default.go @@ -49,7 +49,7 @@ var DefaultConfig = Config{ Importer: &Importer{ LowMemory: false, Timeout: Duration{30 * time.Minute}, - UpdateAt: mustLocalTime("04:00:00"), + UpdateAt: mustLocalTime("03:00:00"), Sources: map[string]*Source{ "nixos": { Name: "NixOS", diff --git a/internal/config/structs.go b/internal/config/structs.go index dd79303..b31e0cd 100644 --- a/internal/config/structs.go +++ b/internal/config/structs.go @@ -31,7 +31,7 @@ type Importer struct { Sources map[string]*Source LowMemory bool `comment:"Use less memory at the expense of import performance"` Timeout Duration `comment:"Abort fetch and import process for all jobs if it takes longer than this value."` - UpdateAt LocalTime `comment:"Local time of day to run fetch/import process"` + UpdateAt LocalTime `comment:"Time of day (UTC) to run fetch/import process"` } type Source struct { diff --git a/justfile b/justfile index 46c927a..dfa7bec 100644 --- a/justfile +++ b/justfile @@ -27,6 +27,9 @@ format: fix: go fix . +generate-defaults: + wgo run --exit ./cmd/searchix-web --print-default-config > defaults.toml + precommit: nix-build -A pre-commit-check diff --git a/nix/modules/default.nix b/nix/modules/default.nix index 3186236..b3a0211 100644 --- a/nix/modules/default.nix +++ b/nix/modules/default.nix @@ -10,7 +10,7 @@ let inherit (builtins) fromTOML readFile; cfg = config.services.searchix; - package = self.packages.default; + package = self.packages.${pkgs.system}.default; defaults = fromTOML (readFile ../../defaults.toml); diff --git a/nix/package.nix b/nix/package.nix index fc2cae4..3949222 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -13,7 +13,7 @@ , css }: let - version = "0.1.11"; + version = "0.1.12"; in buildGoApplication { pname = "searchix"; 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 { |