Skip to content

Commit defa2fd

Browse files
committed
fix status update
1 parent 15cc5c5 commit defa2fd

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

routers/api/actions/runner/runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ func (s *Service) UpdateTask(
230230
if err := actions_service.EmitJobsIfReadyByRun(task.Job.RunID); err != nil {
231231
log.Error("Emit ready jobs of run %d: %v", task.Job.RunID, err)
232232
}
233+
if task.Job.Run.Status.IsDone() {
234+
actions_service.NotifyWorkflowRunStatusUpdateWithReload(ctx, task.Job)
235+
}
233236
}
234237

235238
return connect.NewResponse(&runnerv1.UpdateTaskResponse{

services/actions/job_emitter.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,20 @@ func checkJobsByRunID(ctx context.Context, runID int64) error {
9090
_ = job.LoadAttributes(ctx)
9191
notify_service.WorkflowJobStatusUpdate(ctx, job.Run.Repo, job.Run.TriggerUser, job, nil)
9292
}
93-
if len(jobs) > 0 {
93+
runJobs := make(map[int64][]*actions_model.ActionRunJob)
94+
for _, job := range jobs {
95+
runJobs[job.RunID] = append(runJobs[job.RunID], job)
96+
}
97+
runUpdatedJobs := make(map[int64][]*actions_model.ActionRunJob)
98+
for _, uj := range updatedJobs {
99+
runUpdatedJobs[uj.RunID] = append(runUpdatedJobs[uj.RunID], uj)
100+
}
101+
for runID, js := range runJobs {
102+
if len(runUpdatedJobs[runID]) == 0 {
103+
continue
104+
}
94105
runUpdated := true
95-
for _, job := range jobs {
106+
for _, job := range js {
96107
if !job.Status.IsDone() {
97108
runUpdated = false
98109
break

0 commit comments

Comments
 (0)