fix(tasks): do not use typesense modified options to search with database
This commit is contained in:
parent
5644130f01
commit
7f27cee6a3
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user