fix(typesense): only fail silently when a project was not found during indexing
This commit is contained in:
parent
05dd05216d
commit
b3bf92b7ce
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user