Skip to content

Commit

Permalink
Fix warning log when creating a new cache dir
Browse files Browse the repository at this point in the history
Signed-off-by: Changxin Miao <[email protected]>
  • Loading branch information
polyrabbit committed Sep 27, 2024
1 parent 8824126 commit 68f6ff2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/chunk/disk_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ func (cache *cacheStore) createDir(dir string) {
var st os.FileInfo
var err error
if st, err = os.Stat(dir); os.IsNotExist(err) {
if len(dir) > 1 && strings.HasSuffix(dir, string(filepath.Separator)) {
dir = dir[:len(dir)-1] // CacheManager appends "/" to dir, remove it so that `filepath.Dir` returns the parent dir
}
if filepath.Dir(dir) != dir {
cache.createDir(filepath.Dir(dir))
}
Expand Down

0 comments on commit 68f6ff2

Please sign in to comment.