From 3b2185709761de158c3d59ea44a725c7bed97cad Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 30 Nov 2020 11:53:11 +0000 Subject: [PATCH] config: clear fs cache of stale entries when altering config - fixes #4811 Before this change if a config was altered via the rc then when a new backend was created from that config, if there was a backend already running from the old config in the cache then it would be used instead of creating a new backend with the new config, thus leading to confusion. This change flushes the fs cache of any backends based off a config when that config is changed is over the rc. --- fs/config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/config/config.go b/fs/config/config.go index 4e48a7f7b..f2f0a7440 100644 --- a/fs/config/config.go +++ b/fs/config/config.go @@ -18,6 +18,7 @@ import ( "github.com/pkg/errors" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/fs/cache" "github.com/rclone/rclone/fs/config/obscure" "github.com/rclone/rclone/fs/fspath" "github.com/rclone/rclone/fs/rc" @@ -316,6 +317,7 @@ func UpdateRemote(ctx context.Context, name string, keyValues rc.Params, doObscu } RemoteConfig(ctx, name) SaveConfig() + cache.ClearConfig(name) // remove any remotes based on this config from the cache return nil }