Skip to content

Commit a5ee374

Browse files
committed
revert changes to cache
1 parent f80d838 commit a5ee374

File tree

2 files changed

+7
-174
lines changed

2 files changed

+7
-174
lines changed

coderd/files/cache.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,10 @@ import (
1414
"github.com/coder/coder/v2/coderd/util/lazy"
1515
)
1616

17-
func New(fetch fetcher) *Cache {
18-
return &Cache{
19-
lock: sync.Mutex{},
20-
data: make(map[uuid.UUID]*cacheEntry),
21-
fetcher: fetch,
22-
}
23-
}
24-
2517
// NewFromStore returns a file cache that will fetch files from the provided
2618
// database.
27-
func NewFromStore(store database.Store) *Cache {
28-
fetch := func(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
19+
func NewFromStore(store database.Store) Cache {
20+
fetcher := func(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
2921
file, err := store.GetFileByID(ctx, fileID)
3022
if err != nil {
3123
return nil, xerrors.Errorf("failed to read file from database: %w", err)
@@ -35,7 +27,11 @@ func NewFromStore(store database.Store) *Cache {
3527
return archivefs.FromTarReader(content), nil
3628
}
3729

38-
return New(fetch)
30+
return Cache{
31+
lock: sync.Mutex{},
32+
data: make(map[uuid.UUID]*cacheEntry),
33+
fetcher: fetcher,
34+
}
3935
}
4036

4137
// Cache persists the files for template versions, and is used by dynamic

coderd/parameters_internal_test.go

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)