Fix IntelliJ warning

This commit is contained in:
Deluan 2023-04-04 13:01:32 -04:00
parent 8bb141b730
commit bd402fb2a8
1 changed files with 4 additions and 4 deletions

View File

@ -114,8 +114,8 @@ func (fc *fileCache) Get(ctx context.Context, arg Item) (*CachedStream, error) {
log.Trace(ctx, "Cache MISS", "cache", fc.name, "key", key)
reader, err := fc.getReader(ctx, arg)
if err != nil {
r.Close()
w.Close()
_ = r.Close()
_ = w.Close()
_ = fc.invalidate(ctx, key)
return nil, err
}
@ -211,7 +211,7 @@ func newFSCache(name, cacheSize, cacheFolder string, maxItems int) (fscache.Cach
h := fscache.NewLRUHaunterStrategy(lru)
cacheFolder = filepath.Join(conf.Server.DataFolder, cacheFolder)
var fs fscache.FileSystem
var fs *spreadFS
log.Info(fmt.Sprintf("Creating %s cache", name), "path", cacheFolder, "maxSize", humanize.Bytes(size))
fs, err = NewSpreadFS(cacheFolder, 0755)
if err != nil {
@ -224,7 +224,7 @@ func newFSCache(name, cacheSize, cacheFolder string, maxItems int) (fscache.Cach
log.Error(fmt.Sprintf("Error initializing %s cache", name), err)
return nil, err
}
ck.SetKeyMapper(fs.(*spreadFS).KeyMapper)
ck.SetKeyMapper(fs.KeyMapper)
return ck, nil
}