From 383ee780613116e78db9114a39a2d6127533463c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 19 Mar 2025 20:49:46 +0100 Subject: feat: show last/next/current indexing run time --- searchix.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'searchix.go') 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) } }) } -- cgit 1.4.1