Skip to content

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

fix: enabled timing task check only for schema update (#364)

Luke Zhoua3cce4406f78
diff --git a/server/task_check_executor_timing.go b/server/task_check_executor_timing.go
index 4c3e7db6d8..5d6fedb19a 100644
--- a/server/task_check_executor_timing.go
+++ b/server/task_check_executor_timing.go
@@ -32,24 +32,24 @@ func (exec *TaskCheckTimingExecutor) Run(ctx context.Context, server *Server, ta
return []api.TaskCheckResult{}, common.Errorf(common.Invalid, fmt.Errorf("invalid check timing payload: %w", err))
}
- if time.Now().Before(time.Unix(payload.EarliestAllowedTs, 0)) {
+ if payload.EarliestAllowedTs == 0 {
return []api.TaskCheckResult{
{
- Status: api.TaskCheckStatusError,
- Code: common.TaskTimingNotAllowed,
- Title: "Not ready to run",
- Content: fmt.Sprintf("Need to wait until the configured earliest running time: %s", time.Unix(payload.EarliestAllowedTs, 0).Format(dataFormat)),
+ Status: api.TaskCheckStatusSuccess,
+ Code: common.Ok,
+ Title: "OK",
+ Content: "Earliest allowed time unset",
},
}, nil
}
- if payload.EarliestAllowedTs == 0 {
+ if time.Now().Before(time.Unix(payload.EarliestAllowedTs, 0)) {
return []api.TaskCheckResult{
{
- Status: api.TaskCheckStatusSuccess,
- Code: common.Ok,
- Title: "OK",
- Content: "Earliest allowed time unset",
+ Status: api.TaskCheckStatusError,
+ Code: common.TaskTimingNotAllowed,
+ Title: "Not ready to run",
+ Content: fmt.Sprintf("Need to wait until the configured earliest running time: %s", time.Unix(payload.EarliestAllowedTs, 0).Format(dataFormat)),
},
}, nil
}
diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.go
index c96918b077..edac6c5748 100644
--- a/server/task_check_scheduler.go
+++ b/server/task_check_scheduler.go
@@ -353,7 +353,7 @@ func (s *Server) passCheck(ctx context.Context, server *Server, task *api.Task,
zap.Int("task_id", task.ID),
zap.String("task_name", task.Name),
zap.String("task_type", string(task.Type)),
- zap.String("task_check_type", string(api.TaskCheckDatabaseConnect)),
+ zap.String("task_check_type", string(checkType)),
)
return false, nil
}
diff --git a/server/task_scheduler.go b/server/task_scheduler.go
index c15e3f7df8..3bc44e2feb 100644
--- a/server/task_scheduler.go
+++ b/server/task_scheduler.go
@@ -234,12 +234,14 @@ func (s *TaskScheduler) Register(taskType string, executor TaskExecutor) {
// ScheduleIfNeeded schedules the task if its required check does not contain error in the latest run
func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*api.Task, error) {
// timing task check
- pass, err := s.server.passCheck(ctx, s.server, task, api.TaskCheckGeneralEarliestAllowedTime)
- if err != nil {
- return nil, err
- }
- if !pass {
- return task, nil
+ if task.EarliestAllowedTs != 0 {
+ pass, err := s.server.passCheck(ctx, s.server, task, api.TaskCheckGeneralEarliestAllowedTime)
+ if err != nil {
+ return nil, err
+ }
+ if !pass {
+ return task, nil
+ }
}
// only schema update task has required task check