1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: fix inefficient directory caching when directory reads are slow

Before this change, when querying directories with large datasets, if
the query duration exceeded the directory cache expiration time, the
cache became invalid by the time results were retrieved. This means
every execution of `_readDir` triggers `_readDirFromEntries`,
resulting in prolonged processing times.

After this change we update the directory time with the time at the
end of the query.
This commit is contained in:
huanghaojun
2025-04-09 18:58:09 +08:00
committed by GitHub
parent a5d03e0ada
commit 49f6ed5f5e

View File

@@ -581,7 +581,7 @@ func (d *Dir) _readDir() error {
return err
}
d.read = when
d.read = time.Now()
d.cleanupTimer.Reset(time.Duration(d.vfs.Opt.DirCacheTime * 2))
return nil