about summary refs log tree commit diff stats
path: root/cmd/searchix-web
diff options
context:
space:
mode:
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 {