逻辑错误。已缓存master时,修改master会因为id不匹配config导致引用错误的FileClient实现类

This commit is contained in:
lan 2023-10-17 22:01:34 +08:00
parent 0af205ede1
commit 43985bff93

View File

@ -58,9 +58,9 @@ public class FileConfigServiceImpl implements FileConfigService {
FileConfigDO config = Objects.equals(CACHE_MASTER_ID, id) ? FileConfigDO config = Objects.equals(CACHE_MASTER_ID, id) ?
fileConfigMapper.selectByMaster() : fileConfigMapper.selectById(id); fileConfigMapper.selectByMaster() : fileConfigMapper.selectById(id);
if (config != null) { if (config != null) {
fileClientFactory.createOrUpdateFileClient(id, config.getStorage(), config.getConfig()); fileClientFactory.createOrUpdateFileClient(config.getId(), config.getStorage(), config.getConfig());
} }
return fileClientFactory.getFileClient(id); return fileClientFactory.getFileClient(null == config ? id : config.getId());
} }
}); });