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

当尝试获取一个不存在的namespace后,会被自动添加到trySync中,这个动作是否有参数可以控制禁用? #101

Open
3 tasks done
anyuan95 opened this issue Feb 23, 2025 · 2 comments

Comments

@anyuan95
Copy link

描述bug

在通过ConfigService.getConfig传入一个不存在的namespace后,看了下代码目前是会自动定时执行trySync,然后会不停地打印如下warn日志:
Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: xxapp, cluster: default, namespace: messages-en, url: http://x.x.x.x:8080/configs/xxapp/default/messages-en [Cause: ApolloConfigStatusCodeException([status code: 404] Could not find config for namespace - appId: xxapp, cluster: default, namespace: messages-en, please check whether the configs are released in Apollo!)]
想咨询下我是否有办法控制找不到的namespace不要自动进行trySync?

描述下我们的使用场景:我们希望使用apollo做spring-boot-i18n的配置管理,即将每种语言的messages文件作为namespace配置到apollo中。目前的实现是会有一个fallback机制,例如如果找不到messages-zh_CN就尝试找messages-zh,但是目前发现会不停地对找不到的namespace进行trySync。所以想问下这种机制是否有参数进行控制?或者我是否有办法直接根据appId获取所有可见(或私有)的namespace列表?

复现

使用ConfigService.getConfig(appId, namespace)方法,传入一个不存在的namespace,会不停trySync,然后打印WARN级别的Sync config failed日志

期望

期望:是否有办法控制找不到的namespace不要进行trySync?或者是否有api能够获取appId下的所有可见或私有的namespace列表?

额外的细节和日志

  • 版本:2.4.0
@nobodyiam
Copy link
Member

是否有办法直接根据appId获取所有可见(或私有)的namespace列表?
可以参考 https://www.apolloconfig.com/#/zh/portal/apollo-open-api-platform

@anyuan95
Copy link
Author

感谢api。
不过感觉这样很割裂,项目中既要配置meta-server地址,又要配置portal地址。
请问有什么更好的方法吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants