diff --git a/internal/config/config.go b/internal/config/config.go index f06efb3..111c29b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -99,6 +99,7 @@ type Rclone struct { VfsReadChunkSize string `json:"vfs_read_chunk_size,omitempty"` // Read chunk size (default 128M) VfsReadChunkSizeLimit string `json:"vfs_read_chunk_size_limit,omitempty"` // Max chunk size (default off) VfsReadAhead string `json:"vfs_read_ahead,omitempty"` // read ahead size + VfsPollInterval string `json:"vfs_poll_interval,omitempty"` // How often to rclone cleans the cache (default 1m) BufferSize string `json:"buffer_size,omitempty"` // Buffer size for reading files (default 16M) // File system settings @@ -415,6 +416,7 @@ func (c *Config) setDefaults() { if c.Rclone.VfsCacheMode != "off" { c.Rclone.VfsCachePollInterval = cmp.Or(c.Rclone.VfsCachePollInterval, "1m") c.Rclone.VfsReadChunkSizeLimit = cmp.Or(c.Rclone.VfsReadChunkSizeLimit, "off") + c.Rclone.VfsCachePollInterval = cmp.Or(c.Rclone.VfsCachePollInterval, "1m") // Clean cache every minute } c.Rclone.AttrTimeout = cmp.Or(c.Rclone.AttrTimeout, "10s") diff --git a/pkg/mount/mount.go b/pkg/mount/mount.go index 368a745..a02326f 100644 --- a/pkg/mount/mount.go +++ b/pkg/mount/mount.go @@ -168,12 +168,11 @@ func (m *Mount) performMount(ctx context.Context, mountfn mountlib.MountFn) erro } vfsOpt := &vfscommon.Options{ - NoModTime: rcloneOpt.NoModTime, - NoChecksum: rcloneOpt.NoChecksum, - PollInterval: 0, // Polling is disabled for webdav - CacheMode: cacheMode, - UID: rcloneOpt.UID, - GID: rcloneOpt.GID, + NoModTime: rcloneOpt.NoModTime, + NoChecksum: rcloneOpt.NoChecksum, + CacheMode: cacheMode, + UID: rcloneOpt.UID, + GID: rcloneOpt.GID, } // Parse duration strings @@ -183,6 +182,12 @@ func (m *Mount) performMount(ctx context.Context, mountfn mountlib.MountFn) erro } } + if rcloneOpt.VfsCachePollInterval != "" { + if vfsCachePollInterval, err := time.ParseDuration(rcloneOpt.VfsCachePollInterval); err == nil { + vfsOpt.CachePollInterval = fs.Duration(vfsCachePollInterval) + } + } + if rcloneOpt.VfsCacheMaxAge != "" { if vfsCacheMaxAge, err := time.ParseDuration(rcloneOpt.VfsCacheMaxAge); err == nil { vfsOpt.CacheMaxAge = fs.Duration(vfsCacheMaxAge) diff --git a/pkg/web/templates/config.html b/pkg/web/templates/config.html index 207fdc1..1f5470b 100644 --- a/pkg/web/templates/config.html +++ b/pkg/web/templates/config.html @@ -470,7 +470,7 @@
@@ -488,6 +488,16 @@
+
+ + +
+ How often VFS cache dir gets cleaned +
+
+