fix: use existing transaction to claim prebuild (#21862)

- Claiming a prebuild was happening outside a transaction
This commit is contained in:
Jon Ayers
2026-02-02 23:57:59 +00:00
committed by GitHub
parent 5d24e17796
commit 3c1db17361
8 changed files with 20 additions and 22 deletions
+1 -1
View File
@@ -959,7 +959,7 @@ func claimPrebuild(
nextStartAt sql.NullTime,
ttl sql.NullInt64,
) (*database.Workspace, error) {
claimedID, err := claimer.Claim(ctx, now, owner.ID, name, templateVersionPresetID, autostartSchedule, nextStartAt, ttl)
claimedID, err := claimer.Claim(ctx, db, now, owner.ID, name, templateVersionPresetID, autostartSchedule, nextStartAt, ttl)
if err != nil {
// TODO: enhance this by clarifying whether this *specific* prebuild failed or whether there are none to claim.
return nil, xerrors.Errorf("claim prebuild: %w", err)