summaryrefslogtreecommitdiff
path: root/internal/executor/executor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/executor/executor.go')
-rw-r--r--internal/executor/executor.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index f85f1ff..c07171b 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -634,6 +634,21 @@ func (p *Pool) RecoverStaleQueued(ctx context.Context) {
}
}
+// RecoverStaleBlocked promotes any BLOCKED parent task to READY when all of its
+// subtasks are already COMPLETED. This handles the case where the server was
+// restarted after subtasks finished but before maybeUnblockParent could fire.
+// Call this once on server startup, after RecoverStaleRunning and RecoverStaleQueued.
+func (p *Pool) RecoverStaleBlocked() {
+ tasks, err := p.store.ListTasks(storage.TaskFilter{State: task.StateBlocked})
+ if err != nil {
+ p.logger.Error("RecoverStaleBlocked: list tasks", "error", err)
+ return
+ }
+ for _, t := range tasks {
+ p.maybeUnblockParent(t.ID)
+ }
+}
+
// terminalFailureStates are dependency states that cause the waiting task to fail immediately.
var terminalFailureStates = map[task.State]bool{
task.StateFailed: true,