all repos — searchix @ 200857159766d3c6c5831450048348444c5666f4

Search engine for NixOS, nix-darwin, home-manager and NUR users

perf: pass context to importer for better tracing

Alan Pearce
commit

200857159766d3c6c5831450048348444c5666f4

parent

7496bb7e0652d86e2afd05d35e6632dab27c954a

1 file changed, 11 insertions(+), 3 deletions(-)

changed files
M searchix.gosearchix.go
@@ -44,7 +44,7 @@ LowMemory bool
Logger *log.Logger } -func (s *Server) SetupIndex(options *IndexOptions) error { +func (s *Server) SetupIndex(ctx context.Context, options *IndexOptions) error { var i uint cfgEnabledSources := make([]string, len(s.cfg.Importer.Sources)) for key := range s.cfg.Importer.Sources {
@@ -78,6 +78,7 @@ "update",
options.Update, ) err = importer.Start( + ctx, s.cfg, s.log.Named("importer"), write,
@@ -105,7 +106,14 @@ return slices.Contains(cfgEnabledSources, s)
}) if len(newSources) > 0 { s.log.Info("adding new sources", "sources", newSources) - err := importer.Start(s.cfg, options.Logger.Named("importer"), write, false, &newSources) + err := importer.Start( + ctx, + s.cfg, + options.Logger.Named("importer"), + write, + false, + &newSources, + ) if err != nil { return errors.Wrap(err, "Failed to update index with new sources") }
@@ -189,7 +197,7 @@ MonitorSlug: monitorSlug,
Status: sentry.CheckInStatusInProgress, }, monitorConfig) - err = importer.Start(s.cfg, s.log.Named("importer"), s.writeIndex, false, nil) + err = importer.Start(ctx, s.cfg, s.log.Named("importer"), s.writeIndex, false, nil) s.wg.Done() if err != nil { s.log.Warn("error updating index", "error", err)