|
|
@ -373,14 +373,15 @@ func ShouldBlockRunByConcurrency(ctx context.Context, actionRun *ActionRun) (boo |
|
|
|
return false, nil |
|
|
|
return false, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
concurrentRunsNum, err := db.Count[ActionRun](ctx, &FindRunOptions{ |
|
|
|
concurrentRuns, err := db.Find[ActionRun](ctx, &FindRunOptions{ |
|
|
|
RepoID: actionRun.RepoID, |
|
|
|
RepoID: actionRun.RepoID, |
|
|
|
ConcurrencyGroup: actionRun.ConcurrencyGroup, |
|
|
|
ConcurrencyGroup: actionRun.ConcurrencyGroup, |
|
|
|
Status: []Status{StatusWaiting, StatusRunning}, |
|
|
|
Status: []Status{StatusWaiting, StatusRunning}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return false, fmt.Errorf("count running and waiting runs: %w", err) |
|
|
|
return false, fmt.Errorf("find running and waiting runs: %w", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
previousRuns := slices.DeleteFunc(concurrentRuns, func(r *ActionRun) bool { return r.ID == actionRun.ID }) |
|
|
|
|
|
|
|
|
|
|
|
return concurrentRunsNum > 0, nil |
|
|
|
return len(previousRuns) > 0, nil |
|
|
|
} |
|
|
|
} |
|
|
|