Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Task scheduler will only schedule the next task if all task checks pass (no warning and error)

天舟b524a4f47dd8
diff --git a/server/task_scheduler.go b/server/task_scheduler.go
index 58bf23006f..48beb8f80c 100644
--- a/server/task_scheduler.go
+++ b/server/task_scheduler.go
@@ -281,6 +281,8 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*
return updatedTask, nil
}
+// Returns true only if there is NO warning and error. User can still manualy run the task if there is warning.
+// But this method is used for gating the automatic run, so we are more cautious here.
func passCheck(ctx context.Context, server *Server, task *api.Task, checkType api.TaskCheckType) (bool, error) {
statusList := []api.TaskCheckRunStatus{api.TaskCheckRunDone, api.TaskCheckRunFailed}
taskCheckRunFind := &api.TaskCheckRunFind{
@@ -310,7 +312,7 @@ func passCheck(ctx context.Context, server *Server, task *api.Task, checkType ap
return false, err
}
for _, result := range checkResult.ResultList {
- if result.Status == api.TaskCheckStatusError {
+ if result.Status == api.TaskCheckStatusError || result.Status == api.TaskCheckStatusWarn {
server.l.Debug("Task is waiting for check to pass",
zap.Int("task_id", task.ID),
zap.String("task_name", task.Name),