about summary refs log tree commit diff stats
path: root/searchix.go
diff options
context:
space:
mode:
authorAlan Pearce2025-02-14 01:36:40 +0100
committerAlan Pearce2025-02-14 01:36:40 +0100
commitea8c3053006e67210e16ed55febbcb0c6a374b54 (patch)
treecd4ae4d60f21faf3a41fb1de781e5c5c10c66039 /searchix.go
parent3ee8248656c089594ea8a3be41945c408ab39aa4 (diff)
downloadsearchix-ea8c3053006e67210e16ed55febbcb0c6a374b54.tar.lz
searchix-ea8c3053006e67210e16ed55febbcb0c6a374b54.tar.zst
searchix-ea8c3053006e67210e16ed55febbcb0c6a374b54.zip
refactor: split importer args HEAD main
Diffstat (limited to 'searchix.go')
-rw-r--r--searchix.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/searchix.go b/searchix.go
index 615afc6..be76af6 100644
--- a/searchix.go
+++ b/searchix.go
@@ -77,11 +77,9 @@ func (s *Server) SetupIndex(ctx context.Context, options *IndexOptions) error {
 			"update",
 			options.Update,
 		)
-		err = importer.Start(
+		imp := importer.New(s.cfg, s.log.Named("importer"), write)
+		err = imp.Start(
 			ctx,
-			s.cfg,
-			s.log.Named("importer"),
-			write,
 			options.Replace || options.Update,
 			nil,
 		)
@@ -106,11 +104,9 @@ func (s *Server) SetupIndex(ctx context.Context, options *IndexOptions) error {
 			})
 			if len(newSources) > 0 {
 				s.log.Info("adding new sources", "sources", newSources)
-				err := importer.Start(
+				imp := importer.New(s.cfg, options.Logger.Named("importer"), write)
+				err := imp.Start(
 					ctx,
-					s.cfg,
-					options.Logger.Named("importer"),
-					write,
 					false,
 					&newSources,
 				)
@@ -197,7 +193,8 @@ func (s *Server) startUpdateTimer(
 				Status:      sentry.CheckInStatusInProgress,
 			}, monitorConfig)
 
-			err = importer.Start(ctx, s.cfg, s.log.Named("importer"), s.writeIndex, false, nil)
+			imp := importer.New(s.cfg, s.log.Named("importer"), s.writeIndex)
+			err = imp.Start(ctx, false, nil)
 			s.wg.Done()
 			if err != nil {
 				s.log.Warn("error updating index", "error", err)