Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建多个不同的AppId的Config有多个bug #5159

Closed
3 tasks done
qq31715879 opened this issue Jun 12, 2024 · 7 comments
Closed
3 tasks done

创建多个不同的AppId的Config有多个bug #5159

qq31715879 opened this issue Jun 12, 2024 · 7 comments
Labels

Comments

@qq31715879
Copy link

qq31715879 commented Jun 12, 2024

描述bug
创建多个不同的AppId的Config有多个bug
1.com.ctrip.framework.apollo.ConfigService#getConfig
image
通过DefaultConfigManager创建getConfig, 内置
private Map<String, Config> m_configs = Maps.newConcurrentMap();
key是namespace, 但是不同的appid下的namespace可以相同, 然而apollo中还有集群这个维度, 所以这里简单的用namespace不合理

2.手动避开namespace重复问题, 虽然能get不同的config, 但是第二个config无法获取配置

这是配置1 可以正常获取
image
这是配置2, 无法获取配置
image

这是证明只创建一个配置2, 可以正常获取配置的截图
image

简洁明了地描述一下bug

复现

通过如下步骤可以复现:

期望

简介明了地描述你希望正常情况下应该发生什么

截图

如果可以,附上截图来描述你的问题

额外的细节和日志

  • 版本:
  • 错误日志
  • 配置:
  • 平台和操作系统
@qq31715879
Copy link
Author

com.ctrip.framework.apollo.util.ConfigUtil#getAppId
这里获取appid没有获取最新的

@qq31715879
Copy link
Author

com.ctrip.framework.apollo.internals.RemoteConfigRepository#loadApolloConfig
image
修改了这里能获取到第二个appid所属配置, 但是观测整体架构是应对获取单个appid而写的client jar

@qq31715879
Copy link
Author

总结一下有两处bug
1.namespace有缓存; 不同app.id需要设置不同的namespace可以跳过

2.app.id有缓存; 创建第二个config的时候, 无法指定新的app.id; app.id是全局的, 就算能修改, 也会影响其他config
com.ctrip.framework.apollo.internals.AbstractConfigRepository#trySync
com.ctrip.framework.apollo.internals.RemoteConfigRepository#loadApolloConfig

@nobodyiam
Copy link
Member

apollo-client 还没有支持多 app.id,你这个是自己实现的吗?

see apolloconfig/apollo-java#65

@qq31715879
Copy link
Author

是的, 简易修改的代码; 阅读apollo-client代码之后, 感觉apollo-client更像是一个简单的实例, 如果能支持多实例就好了

Copy link

stale bot commented Jul 27, 2024

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 27, 2024
Copy link

stale bot commented Aug 7, 2024

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants