-
Notifications
You must be signed in to change notification settings - Fork 32
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
ConfigService get_config Blocking Main Thread #241
Comments
I’m attempting to fix this issue.🙋 |
哇,非常好的提议。 |
但这里的重试主要是初始化链接时候的,应该不是 get_config 的 block。如果 block 住了是否 build() 没正常连上服务端? |
是的,因为可能会有网络原因无法连上服务器 |
设置最大连接次数能规避。 |
调用是这样的get_config-> |
可能希望单纯的希望当nacos server端网络连接不通的时候不必强依赖nacos也可以启动起来,因为这样强阻塞线程会让其他流程代码无法往下进行 |
看起来也非常奇怪,不过设置最大重试次数抛出 Error 对 sdk 来说没问题。 |
或许在FailoverConnection send_request里增加一个时间,在指定时间里没有执行成功,返回一次错误 |
我相信你设定 max_retry 肯定也会遇到这个问题,等你实践和觉得如何改造更佳。 使用 sdk 运行期因为远程 nacos-server 不可用而卡住线程这个确实在之前没有考虑到 |
When using the ConfigService get_config method in the main Tokio thread, the service fails to start if the connection address is not successful.
Although I have a local default configuration and prefer to fetch configurations from a remote source first, the system should fall back to the local configuration if the remote fetch fails.
However, ConfigService get_config blocks the main thread, preventing the service from proceeding.
This issue stems from NacosGrpcConnection’s poll_ready continuously retrying. I propose adding a configurable maximum retry limit, with a default value of None to retain the original logic.
Users could set this limit as needed to control the retry behavior.
The text was updated successfully, but these errors were encountered: