mirror of
https://github.com/rclone/rclone.git
synced 2025-12-15 15:53:41 +00:00
Look for Fs in the cache rather than calling NewFs directly
This will save operations when rclone is used in remote control mode or with the same remote multiple times in the command line.
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/djherbis/times"
|
||||
"github.com/ncw/rclone/fs"
|
||||
fscache "github.com/ncw/rclone/fs/cache"
|
||||
"github.com/ncw/rclone/fs/config"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -100,7 +101,7 @@ func newCache(ctx context.Context, f fs.Fs, opt *Options) (*cache, error) {
|
||||
root := filepath.Join(config.CacheDir, "vfs", f.Name(), fRoot)
|
||||
fs.Debugf(nil, "vfs cache root is %q", root)
|
||||
|
||||
f, err := fs.NewFs(root)
|
||||
f, err := fscache.Get(root)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create cache remote")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user