update InsertRun

This commit is contained in:
Zettat123 2025-07-22 14:50:50 -06:00
parent ea2bc926f5
commit a4b76b6544

View File

@ -18,12 +18,7 @@ import (
// InsertRun inserts a run // InsertRun inserts a run
// The title will be cut off at 255 characters if it's longer than 255 characters. // The title will be cut off at 255 characters if it's longer than 255 characters.
func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobparser.SingleWorkflow) error { func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobparser.SingleWorkflow) error {
ctx, committer, err := db.TxContext(ctx) return db.WithTx(ctx, func(ctx context.Context) error {
if err != nil {
return err
}
defer committer.Close()
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID) index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
if err != nil { if err != nil {
return err return err
@ -94,7 +89,6 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobpar
RunsOn: job.RunsOn(), RunsOn: job.RunsOn(),
Status: status, Status: status,
} }
// check job concurrency // check job concurrency
if job.RawConcurrency != nil && job.RawConcurrency.Group != "" { if job.RawConcurrency != nil && job.RawConcurrency.Group != "" {
runJob.RawConcurrencyGroup = job.RawConcurrency.Group runJob.RawConcurrencyGroup = job.RawConcurrency.Group
@ -143,5 +137,6 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, jobs []*jobpar
} }
} }
return committer.Commit() return nil
})
} }