Skip to content

Commit

Permalink
fix bulk getattr (badly)
Browse files Browse the repository at this point in the history
  • Loading branch information
likeazir committed Aug 30, 2023
1 parent 5461000 commit 8c00080
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions fileretriever/fileclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

var PATH_TTL = 15 * time.Minute
var DEADLINE = 10 * time.Second
var DEADLINE = 1000 * time.Second
var MAX_CONCURRENT_REQUESTS = 2
var PATH_CACHE_SIZE = 5000

Expand Down Expand Up @@ -220,13 +220,13 @@ func (f *FileClient) netFileInfoDir(path RemotePath, peer string) (*DirFInfo, er
var dirFInfo DirFInfo
dirFInfo.FInfos = make([]FInfo, 0)
for i := 0; i < int(nFinfo[0]); i++ {
var fInfo FInfo
fInfo := new(FInfo)
err = struc.Unpack(conn, fInfo)
if err != nil {
log.Debug().Err(err).Msgf("Failed to write file info for dir %s", request.Path)
continue
}
dirFInfo.FInfos = append(dirFInfo.FInfos, fInfo)
dirFInfo.FInfos = append(dirFInfo.FInfos, *fInfo)
}
return &dirFInfo, nil
}
Expand Down Expand Up @@ -474,7 +474,9 @@ func (f *FileClient) netReadDirAllPeers(path RemotePath) (map[string][]fuse.DirE
continue
}
for _, fInfo := range dirFinfo.FInfos {
f.fInfoCache.Add(path.Append(fInfo.Name), &fInfo)
fc := new(FInfo)
*fc = fInfo
f.fInfoCache.Add(path.Append(fInfo.Name), fc)
log.Trace().Msg(fInfo.Name + " added to file cache")
}
}
Expand Down
2 changes: 1 addition & 1 deletion fileretriever/fileserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (f *FileServer) handleDirFInfo(conn net.Conn, request *FileRequest) {
log.Debug().Err(err).Msgf("Failed to write num of file infos for dir %s", request.Path)
}
for _, fInfo := range fInfos.FInfos {
err = struc.Pack(conn, fInfo)
err = struc.Pack(conn, &fInfo)
if err != nil {
log.Debug().Err(err).Msgf("Failed to write file info for dir %s", request.Path)
}
Expand Down

0 comments on commit 8c00080

Please sign in to comment.