about summary refs log tree commit diff stats
path: root/cmd/searchix-web
diff options
context:
space:
mode:
authorAlan Pearce2025-01-23 14:54:12 +0100
committerAlan Pearce2025-01-24 13:04:41 +0100
commit200857159766d3c6c5831450048348444c5666f4 (patch)
tree36fb6ebbbc91e609106c8f199e01cf00ab830c3f /cmd/searchix-web
parent7496bb7e0652d86e2afd05d35e6632dab27c954a (diff)
downloadsearchix-200857159766d3c6c5831450048348444c5666f4.tar.lz
searchix-200857159766d3c6c5831450048348444c5666f4.tar.zst
searchix-200857159766d3c6c5831450048348444c5666f4.zip
perf: pass context to importer for better tracing
Diffstat (limited to 'cmd/searchix-web')
-rw-r--r--cmd/searchix-web/main.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/searchix-web/main.go b/cmd/searchix-web/main.go
index 63b1ec5..2cffb6b 100644
--- a/cmd/searchix-web/main.go
+++ b/cmd/searchix-web/main.go
@@ -53,12 +53,15 @@ func main() {
 
 	log.SetLevel(cfg.LogLevel)
 
+	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
+	defer cancel()
+
 	s, err := searchix.New(cfg, logger)
 	if err != nil {
 		logger.Fatal("Failed to initialise searchix", "error", err)
 	}
 
-	err = s.SetupIndex(&searchix.IndexOptions{
+	err = s.SetupIndex(ctx, &searchix.IndexOptions{
 		Update:    *update,
 		Replace:   *replace,
 		LowMemory: cfg.Importer.LowMemory,
@@ -69,12 +72,9 @@ func main() {
 	}
 
 	if *replace || *update {
-		os.Exit(0)
+		return
 	}
 
-	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
-	defer cancel()
-
 	go func() {
 		err = s.Start(ctx, *dev)
 		if err != nil {