Skip to content

Commit

Permalink
fix: unable to reset pending task status
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jul 16, 2023
1 parent 54f4a52 commit f271a2f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion task/scheduler/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ func (svc *Service) SetInterval(interval time.Duration) {
func (svc *Service) initTaskStatus() {
// set status of running tasks as TaskStatusAbnormal
runningTasks, err := svc.modelSvc.GetTaskList(bson.M{
"status": constants.TaskStatusRunning,
"status": bson.M{
"$in": []string{
constants.TaskStatusPending,
constants.TaskStatusRunning,
},
},
}, nil)
if err != nil {
if err == mongo2.ErrNoDocuments {
Expand All @@ -173,6 +178,9 @@ func (svc *Service) initTaskStatus() {
}
}(&t)
}
if err := svc.modelSvc.GetBaseService(interfaces.ModelIdTaskQueue).DeleteList(nil); err != nil {
return
}
}

func (svc *Service) isMasterNode(t *models.Task) (ok bool, err error) {
Expand Down

0 comments on commit f271a2f

Please sign in to comment.