chore: use database in current context for file cache (#18490)

Using the db.Store when in a TX causes a deadlock for dbmem.
In production, this can cause a deadlock if at the current conn pool
limit.
This commit is contained in:
Steven Masley
2025-06-23 11:58:52 -05:00
committed by GitHub
parent 659b787b9f
commit c1b35bf2f6
5 changed files with 62 additions and 63 deletions

View File

@ -169,14 +169,14 @@ func (r *loader) dynamicRenderer(ctx context.Context, db database.Store, cache *
var templateFS fs.FS
var err error
templateFS, err = cache.Acquire(fileCtx, r.job.FileID)
templateFS, err = cache.Acquire(fileCtx, db, r.job.FileID)
if err != nil {
return nil, xerrors.Errorf("acquire template file: %w", err)
}
var moduleFilesFS *files.CloseFS
if r.terraformValues.CachedModuleFiles.Valid {
moduleFilesFS, err = cache.Acquire(fileCtx, r.terraformValues.CachedModuleFiles.UUID)
moduleFilesFS, err = cache.Acquire(fileCtx, db, r.terraformValues.CachedModuleFiles.UUID)
if err != nil {
return nil, xerrors.Errorf("acquire module files: %w", err)
}