Skip to content

Commit 20b5777

Browse files
committed
update
1 parent ec62f81 commit 20b5777

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

services/actions/clear_tasks.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,23 @@ func CancelAbandonedJobs(ctx context.Context) error {
134134
}
135135
}
136136

137-
for _, job := range updatedRuns {
138-
c, err := db.Count[actions_model.ActionRunJob](ctx, actions_model.FindRunJobOptions{
139-
RunID: job.RunID,
140-
Statuses: []actions_model.Status{actions_model.StatusWaiting, actions_model.StatusBlocked, actions_model.StatusRunning},
141-
})
137+
for runid, job := range updatedRuns {
138+
jobs, err := actions_model.GetRunJobsByRunID(ctx, runid)
142139
if err != nil {
143-
log.Error("Count waiting jobs for run %d: %v", job.RunID, err)
140+
log.Error("Count waiting jobs for run %d: %v", runid, err)
144141
continue
145142
}
146-
if c == 0 {
147-
NotifyWorkflowRunStatusUpdateWithReload(ctx, job)
143+
unfinished := false
144+
for _, job := range jobs {
145+
if !job.Status.IsDone() {
146+
unfinished = true
147+
break
148+
}
149+
}
150+
if unfinished {
151+
continue
148152
}
153+
NotifyWorkflowRunStatusUpdateWithReload(ctx, job)
149154
}
150155

151156
return nil

0 commit comments

Comments
 (0)