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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user