vfs: convert time.Duration option to fs.Duration

This commit is contained in:
Nick Craig-Wood
2024-07-02 17:31:51 +01:00
parent 2c57fe9826
commit fc1d8dafd5
17 changed files with 66 additions and 66 deletions

View File

@@ -232,7 +232,7 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
if do := features.ChangeNotify; do != nil {
vfs.pollChan = make(chan time.Duration)
do(context.TODO(), vfs.root.changeNotify, vfs.pollChan)
vfs.pollChan <- vfs.Opt.PollInterval
vfs.pollChan <- time.Duration(vfs.Opt.PollInterval)
} else if vfs.Opt.PollInterval > 0 {
fs.Infof(f, "poll-interval is not supported by this remote")
}
@@ -608,7 +608,7 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
defer vfs.usageMu.Unlock()
total, used, free = -1, -1, -1
doAbout := vfs.f.Features().About
if (doAbout != nil || vfs.Opt.UsedIsSize) && (vfs.usageTime.IsZero() || time.Since(vfs.usageTime) >= vfs.Opt.DirCacheTime) {
if (doAbout != nil || vfs.Opt.UsedIsSize) && (vfs.usageTime.IsZero() || time.Since(vfs.usageTime) >= time.Duration(vfs.Opt.DirCacheTime)) {
var err error
ctx := context.TODO()
if doAbout == nil {