Skip to content

Commit 2ad1e67

Browse files
committed
fix
1 parent 23c80cf commit 2ad1e67

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

routers/web/repo/actions/view.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ func Rerun(ctx *context_module.Context) {
459459
ctx.ServerError("PrepareToStartRunWithConcurrency", err)
460460
return
461461
}
462+
// FIXME: old code sets "status" to "running" if it isn't blocked, should we do it? Or keep the status as "waiting"?
462463
}
463464
if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "previous_duration", "status", "concurrency_group", "concurrency_cancel"); err != nil {
464465
ctx.ServerError("UpdateRun", err)

services/actions/clear_tasks.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ func PrepareToStartJobWithConcurrency(ctx context.Context, job *actions_model.Ac
8686
if err != nil {
8787
return actions_model.StatusBlocked, err
8888
}
89+
90+
// even if the current job is blocked, we still need to cancel previous "blocked" jobs in the same concurrency group
91+
jobs, err := actions_model.CancelPreviousJobsByJobConcurrency(ctx, job)
92+
8993
if shouldBlock {
9094
return actions_model.StatusBlocked, nil
9195
}
92-
jobs, err := actions_model.CancelPreviousJobsByJobConcurrency(ctx, job)
9396
notifyWorkflowJobStatusUpdate(ctx, jobs)
9497
return actions_model.StatusWaiting, err
9598
}
@@ -114,10 +117,13 @@ func PrepareToStartRunWithConcurrency(ctx context.Context, run *actions_model.Ac
114117
if err != nil {
115118
return actions_model.StatusBlocked, err
116119
}
120+
121+
// even if the current run is blocked, we still need to cancel previous "blocked" jobs in the same concurrency group
122+
jobs, err := actions_model.CancelPreviousJobsByRunConcurrency(ctx, run)
123+
117124
if shouldBlock {
118125
return actions_model.StatusBlocked, nil
119126
}
120-
jobs, err := actions_model.CancelPreviousJobsByRunConcurrency(ctx, run)
121127
notifyWorkflowJobStatusUpdate(ctx, jobs)
122128
return actions_model.StatusWaiting, err
123129
}

0 commit comments

Comments
 (0)