Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert changes to cache
  • Loading branch information
Emyrk committed May 15, 2025
commit a5ee3747dff2e51cf0052bc57385bfb9c5ba78cd
18 changes: 7 additions & 11 deletions coderd/files/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ import (
"github.com/coder/coder/v2/coderd/util/lazy"
)

func New(fetch fetcher) *Cache {
return &Cache{
lock: sync.Mutex{},
data: make(map[uuid.UUID]*cacheEntry),
fetcher: fetch,
}
}

// NewFromStore returns a file cache that will fetch files from the provided
// database.
func NewFromStore(store database.Store) *Cache {
fetch := func(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
func NewFromStore(store database.Store) Cache {
fetcher := func(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
file, err := store.GetFileByID(ctx, fileID)
if err != nil {
return nil, xerrors.Errorf("failed to read file from database: %w", err)
Expand All @@ -35,7 +27,11 @@ func NewFromStore(store database.Store) *Cache {
return archivefs.FromTarReader(content), nil
}

return New(fetch)
return Cache{
lock: sync.Mutex{},
data: make(map[uuid.UUID]*cacheEntry),
fetcher: fetcher,
}
}

// Cache persists the files for template versions, and is used by dynamic
Expand Down
163 changes: 0 additions & 163 deletions coderd/parameters_internal_test.go

This file was deleted.

Loading