chore: improve terraform install performance (#7478)

This commit is contained in:
Ammar Bandukwala
2023-05-11 19:30:51 +00:00
committed by GitHub
parent 0e6361383c
commit 640fcf450c
4 changed files with 9 additions and 6 deletions
+1 -3
View File
@@ -243,13 +243,11 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
notifyCtx, notifyStop := signal.NotifyContext(ctx, InterruptSignals...)
defer notifyStop()
// Ensure we have a unique cache directory for this process.
cacheDir := filepath.Join(cfg.CacheDir.String(), uuid.NewString())
cacheDir := cfg.CacheDir.String()
err = os.MkdirAll(cacheDir, 0o700)
if err != nil {
return xerrors.Errorf("create cache directory: %w", err)
}
defer os.RemoveAll(cacheDir)
// Clean up idle connections at the end, e.g.
// embedded-postgres can leave an idle connection