fix(typesense): only fail silently when a project was not found during indexing

This commit is contained in:
kolaente 2024-09-19 13:58:15 +02:00
parent 05dd05216d
commit b3bf92b7ce
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 12 additions and 0 deletions

@ -547,6 +547,9 @@ func (l *AddTaskToTypesense) Handle(msg *message.Message) (err error) {
if err != nil {
return err
}
if ttask == nil {
return
}
_, err = typesenseClient.Collection("tasks").
Documents().

@ -251,6 +251,9 @@ func getTypesenseTaskForTask(s *xorm.Session, task *Task, projectsCache map[int6
if projectsCache == nil {
p, err = GetProjectSimpleByID(s, task.ProjectID)
if err != nil {
if IsErrProjectDoesNotExist(err) {
return nil, nil
}
return nil, fmt.Errorf("could not fetch project %d: %s", task.ProjectID, err.Error())
}
} else {
@ -259,6 +262,9 @@ func getTypesenseTaskForTask(s *xorm.Session, task *Task, projectsCache map[int6
if !has {
p, err = GetProjectSimpleByID(s, task.ProjectID)
if err != nil {
if IsErrProjectDoesNotExist(err) {
return nil, nil
}
return nil, fmt.Errorf("could not fetch project %d: %s", task.ProjectID, err.Error())
}
projectsCache[task.ProjectID] = p
@ -305,6 +311,9 @@ func reindexTasksInTypesense(s *xorm.Session, tasks map[int64]*Task) (err error)
if err != nil {
return err
}
if ttask == nil {
continue
}
typesenseTasks = append(typesenseTasks, ttask)
}