From 7f27cee6a3dd22939acad5426ec6360629a51877 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 11 Jul 2024 12:41:40 +0200 Subject: [PATCH] fix(tasks): do not use typesense modified options to search with database --- pkg/models/tasks.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index 9fc115ce3..840727270 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -303,13 +303,14 @@ func getRawTasksForProjects(s *xorm.Session, projects []*Project, a web.Auth, op var tsSearcher taskSearcher = &typesenseTaskSearcher{ s: s, } + origOpts := *opts tasks, totalItems, err = tsSearcher.Search(opts) // It is possible that project views are not yet in Typesnse's index. This causes the query here to fail. // To avoid crashing everything, we fall back to the db search in that case. var tsErr = &typesense.HTTPError{} if err != nil && errors.As(err, &tsErr) && tsErr.Status == 404 { log.Warningf("Unable to fetch tasks from Typesense, error was '%v'. Falling back to db.", err) - tasks, totalItems, err = dbSearcher.Search(opts) + tasks, totalItems, err = dbSearcher.Search(&origOpts) } } else { tasks, totalItems, err = dbSearcher.Search(opts)