Skip to content

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

fix: patch task status race condition (#1394)

p0ny6f41edef7618
diff --git a/server/task.go b/server/task.go
index 3fe6c762e2..c017017092 100644
--- a/server/task.go
+++ b/server/task.go
@@ -439,20 +439,6 @@ func (s *Server) changeTaskStatusWithPatch(ctx context.Context, task *api.Task,
return nil, err
}
- // Schedule the task if it's being just approved
- if task.Status == api.TaskPendingApproval && taskPatched.Status == api.TaskPending {
- skipIfAlreadyTerminated := false
- if _, err := s.TaskCheckScheduler.ScheduleCheckIfNeeded(ctx, taskPatched, api.SystemBotID, skipIfAlreadyTerminated); err != nil {
- return nil, fmt.Errorf("failed to schedule task check \"%v\" after approval", taskPatched.Name)
- }
-
- scheduledTask, err := s.TaskScheduler.ScheduleIfNeeded(ctx, taskPatched)
- if err != nil {
- return nil, fmt.Errorf("failed to schedule task \"%v\" after approval", taskPatched.Name)
- }
- taskPatched = scheduledTask
- }
-
// If create database or schema update task completes, we sync the corresponding instance schema immediately.
if (taskPatched.Type == api.TaskDatabaseCreate || taskPatched.Type == api.TaskDatabaseSchemaUpdate) &&
taskPatched.Status == api.TaskDone {