all repos — searchix @ 832214d72d377f7c02146a77528b6e9c6bb393c8

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

feat: re- ingest/index on SIGUSR1/2

Alan Pearce
commit

832214d72d377f7c02146a77528b6e9c6bb393c8

parent

12a29a55fe895a964d8d317857ee7fb87d4071f1

2 files changed, 29 insertions(+), 3 deletions(-)

changed files
M cmd/searchix-web/serve.gocmd/searchix-web/serve.go
@@ -119,6 +119,28 @@ logger.Fatal("error", "error", err)
} }() + reimport := make(chan os.Signal, 1) + go func() { + for sig := range reimport { + if sig == syscall.SIGUSR1 { + logger.Info("manual fetch on SIGUSR1") + err := imp.Fetch(ctx, false, false, nil) + if err != nil { + logger.Warn("manual fetch error", "error", err) + } + logger.Info("manual fetch succeeded") + } + + logger.Info("manual re-index", "signal", sig.String()) + err := imp.Index(ctx) + if err != nil { + logger.Error("manual index error", "error", err) + } + logger.Info("manual re-index completed") + } + }() + signal.Notify(reimport, syscall.SIGUSR1, syscall.SIGUSR2) + wg.Add(1) go func() { defer wg.Done()
M docs/running.mddocs/running.md
@@ -2,14 +2,14 @@ # Running an instance
## Requirements: -- 400MiB disk space +- 2GiB disk space - ~100MiB RAM (requires setting `Importer.LowMemory = true`) -This [repository](https://git.alanpearce.eu/searchix) (or its [codeberg mirror](https://codeberg.org/alanpearce/searchix)) is importable as a flake containing a NixOS module. +This [repository](https://git.alin.ovh/searchix) (or its [codeberg mirror](https://codeberg.org/alanpearce/searchix)) is importable as a flake containing a NixOS module. ```nix { - inputs.searchix.url = "git+https://git.alanpearce.eu/searchix"; + inputs.searchix.url = "git+https://git.alin.ovh/searchix"; # or inputs.searchix.url = "git+https://codeberg.org/alanpearce/searchix";
@@ -42,3 +42,7 @@ };
``` Where `settings` complies with [NixOS RFC 42 (settings options)](https://github.com/NixOS/rfcs/pull/42); see the [default values](../defaults.toml) for reference. + +## Maintenance + +Whilst the service is running, a `SIGUSR1` will cause a complete re-import and a `SIGUSR2` will cause a re-index.