Skip to content

Commit

Permalink
changed the name of the temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Feb 23, 2025
1 parent bd0e554 commit 497b12f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions engine/sessions/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"log/slog"
"math/rand"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -70,7 +69,7 @@ func CreateSession(cfg *config.Config) (et.Session, error) {
return nil, err
}

c, dir, err := createFileCacheRepo()
c, dir, err := s.createFileCacheRepo()
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -195,13 +194,12 @@ func (s *Session) selectDBMS() error {
return nil
}

func createFileCacheRepo() (repository.Repository, string, error) {
dir, err := os.MkdirTemp("", fmt.Sprintf("test-%d", rand.Intn(100)))
func (s *Session) createFileCacheRepo() (repository.Repository, string, error) {
dir, err := os.MkdirTemp("", s.ID().String())
if err != nil {
return nil, "", errors.New("failed to create the temp dir")
}

//c, err := assetdb.New(sqlrepo.SQLiteMemory, "")
c, err := assetdb.New(sqlrepo.SQLite, filepath.Join(dir, "cache.sqlite"))
if err != nil {
return nil, "", fmt.Errorf("failed to create the cache db: %s", err.Error())
Expand Down

0 comments on commit 497b12f

Please sign in to comment.