only clear backup cache if specific fields changed

This commit is contained in:
Girish Ramakrishnan
2020-08-11 14:01:15 -07:00
parent 885e90e810
commit dd44edde0a

View File

@@ -416,7 +416,11 @@ function setBackupConfig(backupConfig, callback) {
delete backupConfig.password;
}
backups.cleanupCacheFilesSync();
// if any of these changes, we have to clear the cache
if ([ 'format', 'provider', 'prefix', 'bucket', 'region', 'endpoint', 'backupFolder', 'mountPoint', 'encryption' ].some(p => backupConfig[p] !== currentConfig[p])) {
debug('setBackupConfig: clearing backup cache');
backups.cleanupCacheFilesSync();
}
settingsdb.set(exports.BACKUP_CONFIG_KEY, JSON.stringify(backupConfig), function (error) {
if (error) return callback(error);