mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 12:59:32 +01:00
vfs: [bugfix] Update dir modification time
A subtle bug where dir modification time is not updated when the dir already exists in the cache. It is only noticeable when some clients use dir modification time to invalidate cache.
This commit is contained in:
parent
a7978cea56
commit
264b3f0c90
@ -694,9 +694,10 @@ func (d *Dir) _readDirFromEntries(entries fs.DirEntries, dirTree dirtree.DirTree
|
||||
if node == nil || !node.IsDir() {
|
||||
node = newDir(d.vfs, d.f, d, item)
|
||||
}
|
||||
if dirTree != nil {
|
||||
dir := node.(*Dir)
|
||||
dir.mu.Lock()
|
||||
dir.modTime = item.ModTime(context.TODO())
|
||||
if dirTree != nil {
|
||||
err = dir._readDirFromDirTree(dirTree, when)
|
||||
if err != nil {
|
||||
dir.read = time.Time{}
|
||||
@ -704,11 +705,11 @@ func (d *Dir) _readDirFromEntries(entries fs.DirEntries, dirTree dirtree.DirTree
|
||||
dir.read = when
|
||||
dir.cleanupTimer.Reset(d.vfs.Opt.DirCacheTime * 2)
|
||||
}
|
||||
}
|
||||
dir.mu.Unlock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
err = fmt.Errorf("unknown type %T", item)
|
||||
fs.Errorf(d, "readDir error: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user