Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: fix backends being Shutdown too early when startup takes a long time

Nick Craig-Woodfc798d800cee
diff --git a/vfs/vfs.go b/vfs/vfs.go
index 00faadf2e..dc15f2586 100644
--- a/vfs/vfs.go
+++ b/vfs/vfs.go
@@ -227,13 +227,14 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
fs.Logf(f, "--vfs-cache-mode writes or full is recommended for this remote as it can't stream")
}
- vfs.SetCacheMode(vfs.Opt.CacheMode)
-
// 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 when the vfs is finalized
cache.PinUntilFinalized(f, vfs)
+ // This can take some time so do it after the Pin
+ vfs.SetCacheMode(vfs.Opt.CacheMode)
+
return vfs
}