Skip to content

Commit 2330dcf

Browse files
committed
Revert "update"
This reverts commit 20b5777.
1 parent 1bc9097 commit 2330dcf

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

services/actions/clear_tasks.go

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

137-
for runid, job := range updatedRuns {
138-
jobs, err := actions_model.GetRunJobsByRunID(ctx, runid)
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+
})
139142
if err != nil {
140-
log.Error("Count waiting jobs for run %d: %v", runid, err)
143+
log.Error("Count waiting jobs for run %d: %v", job.RunID, err)
141144
continue
142145
}
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
146+
if c == 0 {
147+
NotifyWorkflowRunStatusUpdateWithReload(ctx, job)
152148
}
153-
NotifyWorkflowRunStatusUpdateWithReload(ctx, job)
154149
}
155150

156151
return nil

0 commit comments

Comments
 (0)