diff options
author | Alan Pearce | 2025-03-19 20:49:46 +0100 |
---|---|---|
committer | Alan Pearce | 2025-03-19 20:51:40 +0100 |
commit | 383ee780613116e78db9114a39a2d6127533463c (patch) | |
tree | c07e2af7ae910d5c6f80836dce8457ba44c54ceb /searchix.go | |
parent | 49e3004d33bf84aa081460e4a6d89a8d84cc12b0 (diff) | |
download | searchix-383ee780613116e78db9114a39a2d6127533463c.tar.lz searchix-383ee780613116e78db9114a39a2d6127533463c.tar.zst searchix-383ee780613116e78db9114a39a2d6127533463c.zip |
feat: show last/next/current indexing run time
Diffstat (limited to 'searchix.go')
-rw-r--r-- | searchix.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/searchix.go b/searchix.go index 1c870df..8bd696d 100644 --- a/searchix.go +++ b/searchix.go @@ -7,6 +7,7 @@ import ( "sync" "time" + "go.alanpearce.eu/searchix/internal/components" "go.alanpearce.eu/searchix/internal/config" "go.alanpearce.eu/searchix/internal/importer" "go.alanpearce.eu/searchix/internal/index" @@ -125,6 +126,7 @@ func (s *Server) SetupIndex(ctx context.Context, options *IndexOptions) errors.E } } } + components.SetLastUpdated(read.LastUpdated()) return nil } @@ -175,6 +177,7 @@ func (s *Server) startUpdateTimer( s.wg.Add(1) nextRun := nextUTCOccurrenceOfTime(s.cfg.Importer.UpdateAt) + components.SetNextRun(nextRun) for { s.log.Debug("scheduling next run", "next-run", nextRun) select { @@ -192,6 +195,7 @@ func (s *Server) startUpdateTimer( MonitorSlug: monitorSlug, Status: sentry.CheckInStatusInProgress, }, monitorConfig) + components.MarkIndexingStarted() imp := importer.New(s.cfg, s.log.Named("importer"), s.writeIndex) err = imp.Start(ctx, false, nil) @@ -215,6 +219,7 @@ func (s *Server) startUpdateTimer( }, monitorConfig) } nextRun = nextRun.AddDate(0, 0, 1) + components.MarkIndexingFinished(nextRun) } }) } |