Skip to content

Commit

Permalink
fix: remove prereading
Browse files Browse the repository at this point in the history
  • Loading branch information
likeazir committed Oct 9, 2023
1 parent 871e6ca commit 942362a
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions internal/pkg/cacheclient/cacheclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/hashicorp/golang-lru/v2/expirable"
"github.com/rs/zerolog/log"
"io/fs"
"path/filepath"
"readnetfs/internal/pkg/fsclient"
"sync"
"syscall"
Expand Down Expand Up @@ -106,20 +105,6 @@ func (c *CacheClient) ReadDir(path fsclient.RemotePath) ([]fs.FileInfo, error) {
}

func (c *CacheClient) FileInfo(path fsclient.RemotePath) (fs.FileInfo, error) {
//trigger parent dir read to fill cache for future requests
func() {
c.dirContentLock.Lock()
defer c.dirContentLock.Unlock()
infos, err := c.client.ReadDir(fsclient.RemotePath(filepath.Dir(string(path))))
if err != nil {
return
}
files := make([]string, len(infos))
for i, info := range infos {
files[i] = info.Name()
c.infos.Add(path.Append(info.Name()), info)
}
}()
if info, ok := c.infos.Get(path); ok {
return info, nil
}
Expand Down

0 comments on commit 942362a

Please sign in to comment.