@@ -1451,7 +1451,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
1451
1451
hash := hex .EncodeToString (hashBytes [:])
1452
1452
1453
1453
// nolint:gocritic // Requires reading "system" files
1454
- file ,err := s . Database .GetFileByHashAndCreator (dbauthz .AsSystemRestricted (ctx ), database.GetFileByHashAndCreatorParams {Hash :hash ,CreatedBy :uuid .Nil })
1454
+ file ,err := tx .GetFileByHashAndCreator (dbauthz .AsSystemRestricted (ctx ), database.GetFileByHashAndCreatorParams {Hash :hash ,CreatedBy :uuid .Nil })
1455
1455
if err == nil {
1456
1456
// This set of modules is already cached, which means we can reuse them
1457
1457
fileID = uuid.NullUUID {
@@ -1462,7 +1462,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
1462
1462
return xerrors .Errorf ("check for cached modules: %w" ,err )
1463
1463
}else {
1464
1464
// nolint:gocritic // Requires creating a "system" file
1465
- file ,err = s . Database .InsertFile (dbauthz .AsSystemRestricted (ctx ), database.InsertFileParams {
1465
+ file ,err = tx .InsertFile (dbauthz .AsSystemRestricted (ctx ), database.InsertFileParams {
1466
1466
ID :uuid .New (),
1467
1467
Hash :hash ,
1468
1468
CreatedBy :uuid .Nil ,
@@ -1480,7 +1480,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
1480
1480
}
1481
1481
}
1482
1482
1483
- err = s . Database .InsertTemplateVersionTerraformValuesByJobID (ctx , database.InsertTemplateVersionTerraformValuesByJobIDParams {
1483
+ err = tx .InsertTemplateVersionTerraformValuesByJobID (ctx , database.InsertTemplateVersionTerraformValuesByJobIDParams {
1484
1484
JobID :jobID ,
1485
1485
UpdatedAt :now ,
1486
1486
CachedPlan :plan ,