Skip to content

Commit a5aea1b

Browse files
committed
do not query vars twice
1 parent 0cc6d31 commit a5aea1b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

services/actions/run.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func PrepareRunAndInsert(ctx context.Context, content []byte, run *actions_model
5353
run.Title = jobs[0].RunName
5454
}
5555

56-
if err := InsertRun(ctx, run, jobs); err != nil {
56+
if err := InsertRun(ctx, run, jobs, vars); err != nil {
5757
return fmt.Errorf("InsertRun: %w", err)
5858
}
5959

@@ -81,7 +81,7 @@ func PrepareRunAndInsert(ctx context.Context, content []byte, run *actions_model
8181

8282
// InsertRun inserts a run
8383
// The title will be cut off at 255 characters if it's longer than 255 characters.
84-
func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobparser.SingleWorkflow) error {
84+
func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobparser.SingleWorkflow, vars map[string]string) error {
8585
return db.WithTx(ctx, func(ctx context.Context) error {
8686
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
8787
if err != nil {
@@ -108,12 +108,6 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobpar
108108
return err
109109
}
110110

111-
// query vars for evaluating job concurrency groups
112-
vars, err := actions_model.GetVariablesOfRun(ctx, run)
113-
if err != nil {
114-
return fmt.Errorf("get run %d variables: %w", run.ID, err)
115-
}
116-
117111
runJobs := make([]*actions_model.ActionRunJob, 0, len(jobs))
118112
var hasWaitingJobs bool
119113
for _, v := range jobs {

0 commit comments

Comments
 (0)