Skip to content

Commit 4f5143f

Browse files
committed
fix prepare
1 parent e38d886 commit 4f5143f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

services/actions/clear_tasks.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"code.gitea.io/gitea/modules/log"
1616
"code.gitea.io/gitea/modules/setting"
1717
"code.gitea.io/gitea/modules/timeutil"
18+
"code.gitea.io/gitea/modules/util"
1819
webhook_module "code.gitea.io/gitea/modules/webhook"
1920
notify_service "code.gitea.io/gitea/services/notify"
2021
)
@@ -89,12 +90,9 @@ func PrepareToStartJobWithConcurrency(ctx context.Context, job *actions_model.Ac
8990

9091
// even if the current job is blocked, we still need to cancel previous "blocked" jobs in the same concurrency group
9192
jobs, err := actions_model.CancelPreviousJobsByJobConcurrency(ctx, job)
92-
93-
if shouldBlock {
94-
return actions_model.StatusBlocked, nil
95-
}
9693
notifyWorkflowJobStatusUpdate(ctx, jobs)
97-
return actions_model.StatusWaiting, err
94+
95+
return util.Iif(shouldBlock, actions_model.StatusBlocked, actions_model.StatusWaiting), nil
9896
}
9997

10098
func shouldBlockRunByConcurrency(ctx context.Context, actionRun *actions_model.ActionRun) (bool, error) {
@@ -120,12 +118,9 @@ func PrepareToStartRunWithConcurrency(ctx context.Context, run *actions_model.Ac
120118

121119
// even if the current run is blocked, we still need to cancel previous "blocked" jobs in the same concurrency group
122120
jobs, err := actions_model.CancelPreviousJobsByRunConcurrency(ctx, run)
123-
124-
if shouldBlock {
125-
return actions_model.StatusBlocked, nil
126-
}
127121
notifyWorkflowJobStatusUpdate(ctx, jobs)
128-
return actions_model.StatusWaiting, err
122+
123+
return util.Iif(shouldBlock, actions_model.StatusBlocked, actions_model.StatusWaiting), nil
129124
}
130125

131126
func stopTasks(ctx context.Context, opts actions_model.FindTaskOptions) error {

0 commit comments

Comments
 (0)