feat: make web search timeout configurable
1 file changed, 1 insertion(+), 3 deletions(-)
changed files
M internal/server/mux.go → internal/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()