Add vfs cache poll interval

This commit is contained in:
Mukhtar Akere
2025-08-05 12:29:55 +01:00
parent fab3a7e4f7
commit c620ba3d56
3 changed files with 24 additions and 7 deletions
+2
View File
@@ -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")
+11 -6
View File
@@ -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)
+11 -1
View File
@@ -470,7 +470,7 @@
<div class="form-control">
<label class="label" for="rclone.vfs_read_ahead">
<span class="label-text font-medium">Read Ahead</span>
<span class="label-text font-medium">VFS Read Ahead</span>
</label>
<input type="text" class="input input-bordered" name="rclone.vfs_read_ahead" id="rclone.vfs_read_ahead" placeholder="128k">
<div class="label">
@@ -488,6 +488,16 @@
</div>
</div>
<div class="form-control">
<label class="label" for="rclone.vfs_cache_poll_interval">
<span class="label-text font-medium">VFS Cache Poll Interval</span>
</label>
<input type="text" class="input input-bordered" name="rclone.vfs_cache_poll_interval" id="rclone.vfs_cache_poll_interval" placeholder="1h">
<div class="label">
<span class="label-text-alt">How often VFS cache dir gets cleaned</span>
</div>
</div>
</div>
</div>
</div>