mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
fix caching during directory listing
This commit is contained in:
@@ -57,10 +57,10 @@ func (dir *Dir) Attr(context context.Context, attr *fuse.Attr) error {
|
|||||||
ParentDir: parent,
|
ParentDir: parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("read dir attr: %v", request)
|
glog.V(1).Infof("read dir %s attr: %v", dir.Path, request)
|
||||||
resp, err := client.GetEntryAttributes(context, request)
|
resp, err := client.GetEntryAttributes(context, request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(0).Infof("read dir attr %v: %v", request, err)
|
glog.V(0).Infof("read dir %s attr %v: %v", dir.Path, request, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,8 +226,8 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
|||||||
} else {
|
} else {
|
||||||
dirent := fuse.Dirent{Name: entry.Name, Type: fuse.DT_File}
|
dirent := fuse.Dirent{Name: entry.Name, Type: fuse.DT_File}
|
||||||
ret = append(ret, dirent)
|
ret = append(ret, dirent)
|
||||||
dir.wfs.listDirectoryEntriesCache.Set(dir.Path+"/"+entry.Name, entry, 300*time.Millisecond)
|
|
||||||
}
|
}
|
||||||
|
dir.wfs.listDirectoryEntriesCache.Set(dir.Path+"/"+entry.Name, entry, 300*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error {
|
|||||||
entry := item.Value().(*filer_pb.Entry)
|
entry := item.Value().(*filer_pb.Entry)
|
||||||
file.Chunks = entry.Chunks
|
file.Chunks = entry.Chunks
|
||||||
file.attributes = entry.Attributes
|
file.attributes = entry.Attributes
|
||||||
glog.V(1).Infof("file attr read cached %v attributes", file.Name)
|
// glog.V(1).Infof("file attr read cached %v attributes", file.Name)
|
||||||
} else {
|
} else {
|
||||||
err := file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
err := file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user