mirror of
https://github.com/rclone/rclone.git
synced 2025-08-14 07:49:00 +02:00
config: make parsing of duration options consistent
All user visible Durations should be fs.Duration rather than time.Duration. Suffix is then optional and defaults to s. Additional suffices d, w, M and y are supported, in addition to ms, s, m and h - which are the only ones supported by time.Duration. Absolute times can also be specified, and will be interpreted as duration relative to now.
This commit is contained in:
5
fs/cache/cache.go
vendored
5
fs/cache/cache.go
vendored
@ -6,6 +6,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/filter"
|
||||
@ -25,8 +26,8 @@ func createOnFirstUse() {
|
||||
once.Do(func() {
|
||||
ci := fs.GetConfig(context.Background())
|
||||
c = cache.New()
|
||||
c.SetExpireDuration(ci.FsCacheExpireDuration)
|
||||
c.SetExpireInterval(ci.FsCacheExpireInterval)
|
||||
c.SetExpireDuration(time.Duration(ci.FsCacheExpireDuration))
|
||||
c.SetExpireInterval(time.Duration(ci.FsCacheExpireInterval))
|
||||
c.SetFinalizer(func(value any) {
|
||||
if s, ok := value.(fs.Shutdowner); ok {
|
||||
_ = fs.CountError(context.Background(), s.Shutdown(context.Background()))
|
||||
|
Reference in New Issue
Block a user