all repos — searchix @ 8a1972abb4b429bd62b47cb44e3219d722919faf

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

feat: make web search timeout configurable

Alan Pearce
commit

8a1972abb4b429bd62b47cb44e3219d722919faf

parent

0b2627ff5be310d394fe63063bdf67e22debe12d

1 file changed, 1 insertion(+), 3 deletions(-)

changed files
M internal/server/mux.gointernal/server/mux.go
@@ -13,7 +13,6 @@ "path"
"slices" "strconv" "strings" - "time" "alin.ovh/searchix/frontend" "alin.ovh/searchix/internal/components"
@@ -82,7 +81,6 @@
top := http.NewServeMux() mux := sentryhttp.NewServeMux() - const searchTimeout = 1 * time.Second createSearchHandler := func(importerType config.ImporterType) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { var err error
@@ -123,7 +121,7 @@ }
} page := pagination.New(pageNumber, pageSize) - ctx, cancel := context.WithTimeout(r.Context(), searchTimeout) + ctx, cancel := context.WithTimeout(r.Context(), cfg.Web.SearchTimeout.Duration) results, err := index.Search(ctx, source, qs, page.From, page.Size) cancel()