mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
fs: Pin created backends until parents are finalized
This attempts to solve the backend lifecycle problem by - Pinning backends mentioned on the command line into the cache indefinitely - Unpinning backends when the containing structure (VFS, wrapping backend) is destroyed See: https://forum.rclone.org/t/rclone-rc-backend-command-not-working-as-expected/18834
This commit is contained in:
@@ -234,8 +234,8 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
|
||||
|
||||
// Pin the Fs into the cache so that when we use cache.NewFs
|
||||
// with the same remote string we get this one. The Pin is
|
||||
// removed by Shutdown
|
||||
cache.Pin(f)
|
||||
// removed when the vfs is finalized
|
||||
cache.PinUntilFinalized(f, vfs)
|
||||
|
||||
return vfs
|
||||
}
|
||||
@@ -293,9 +293,6 @@ func (vfs *VFS) Shutdown() {
|
||||
return
|
||||
}
|
||||
|
||||
// Unpin the Fs from the cache
|
||||
cache.Unpin(vfs.f)
|
||||
|
||||
// Remove from active cache
|
||||
activeMu.Lock()
|
||||
configName := fs.ConfigString(vfs.f)
|
||||
|
||||
Reference in New Issue
Block a user