about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2025-03-24 17:18:18 +0100
committerAlan Pearce2025-03-24 17:18:18 +0100
commit41d40588457290477d87346a133be72be6c621cb (patch)
tree315a3527234fec652b7ff15ad425c137203634cf
parent0fb48cf6dd934778584120ebbc9e568c8b80b80e (diff)
downloadsearchix-41d40588457290477d87346a133be72be6c621cb.tar.lz
searchix-41d40588457290477d87346a133be72be6c621cb.tar.zst
searchix-41d40588457290477d87346a133be72be6c621cb.zip
refactor: pass indexer to importer only once in options
-rw-r--r--cmd/searchix-web/main.go2
-rw-r--r--internal/importer/main.go3
2 files changed, 2 insertions, 3 deletions
diff --git a/cmd/searchix-web/main.go b/cmd/searchix-web/main.go
index 62feabc..20d4a94 100644
--- a/cmd/searchix-web/main.go
+++ b/cmd/searchix-web/main.go
@@ -107,7 +107,7 @@ func main() {
 		return
 	}
 
-	err = imp.EnsureSourcesIndexed(ctx, read, write)
+	err = imp.EnsureSourcesIndexed(ctx, read)
 	if err != nil {
 		logger.Fatal("Failed to setup index", "error", err)
 	}
diff --git a/internal/importer/main.go b/internal/importer/main.go
index 71606e9..5b48007 100644
--- a/internal/importer/main.go
+++ b/internal/importer/main.go
@@ -244,7 +244,6 @@ func New(
 func (imp *Importer) EnsureSourcesIndexed(
 	ctx context.Context,
 	read *index.ReadIndex,
-	write *index.WriteIndex,
 ) errors.E {
 	cfgEnabledSources := slices.Collect(maps.Keys(imp.config.Importer.Sources))
 	slices.Sort(cfgEnabledSources)
@@ -275,7 +274,7 @@ func (imp *Importer) EnsureSourcesIndexed(
 		if len(retiredSources) > 0 {
 			imp.log.Info("removing retired sources", "sources", retiredSources)
 			for _, s := range retiredSources {
-				err := write.DeleteBySource(s)
+				err := imp.indexer.DeleteBySource(s)
 				if err != nil {
 					return errors.Wrapf(err, "Failed to remove retired source %s", s)
 				}