-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
feat: Portal 模块 RestTemplate 支持配置 ConnectionTimeToLive #5121
feat: Portal 模块 RestTemplate 支持配置 ConnectionTimeToLive #5121
Conversation
…talConfig `api.connectionTimeToLive` (apolloconfig#5120)
WalkthroughThe changes involve enhancing the Apollo Portal's RestTemplate component to support configurable connection lifetimes. This is achieved by adding a new configuration option in Changes
Possibly related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (2)
- apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java (2 hunks)
- apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java (1 hunks)
Additional comments not posted (3)
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java (2)
31-31
: The import ofTimeUnit
is correctly added to support specifying the time unit for connection TTL.
62-64
: The implementation correctly sets the connection TTL forCloseableHttpClient
. Ensure that the default TTL value of-1
behaves as expected (e.g., connections do not expire prematurely).apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java (1)
172-174
: TheconnectionTimeToLive()
method is correctly implemented to fetch the TTL configuration. Consider documenting the default behavior when the TTL is set to-1
.
Thanks for your contribution. I have a question. Is there any mechanism like RestTemplate timeout reconnect? |
@shoothzj 丢包会产生 read timeout, 但是不同于 TCP FIN or RST, RestTemplate 不会重建连接,还是使用的被故障注入的 IP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense if ClosableHttpClient
will not reconnect after rw timeout
I have read the CLA Document and I hereby sign the CLA |
希望 Portal 模块 RestTemplateFactory 支持配置 ConnectionTimeToLive,详见 #5120
Summary by CodeRabbit