-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][admin] Use ClientConfigurationData timeout params to set AsyncHttpConnector timeout params #25040
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
base: master
Are you sure you want to change the base?
Conversation
| confBuilder.setCookieStore(null); | ||
| confBuilder.setUseProxyProperties(true); | ||
| confBuilder.setFollowRedirect(false); | ||
| confBuilder.setRequestTimeout(conf.getRequestTimeoutMs()); |
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 would be more consistent to set this to requestTimeoutMs, since this is how `connectTimeout and ReadTimeout are also handled.
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.
The requestTimeoutMs param is set twice in this method: once via confBuilder.setRequestTimeout(conf.getRequestTimeoutMs()) and once via confBuilder.setReadTimeout(readTimeoutMs). For this reason, I removed the line confBuilder.setRequestTimeout(conf.getRequestTimeoutMs()).
| PulsarVersion.getVersion(), | ||
| (conf.getDescription() == null ? "" : ("-" + conf.getDescription())) | ||
| )); | ||
| confBuilder.setRequestTimeout(requestTimeoutMs); |
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.
@lhotari here
77dcffd to
bc8f13f
Compare
Motivation
In previous code, we use
client.getConfiguration().getProperty(ClientProperties.CONNECT_TIMEOUT)as PulsarAdmin'sconnectionTimeoutMs, useclient.getConfiguration().getProperty(ClientProperties.READ_TIMEOUT)as PulsarAdmin'sreadTimeoutMs, usePulsarAdminImpl.DEFAULT_REQUEST_TIMEOUT_SECONDS * 1000as PulsarAdmin'srequestTimeoutMs. See:pulsar/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
Lines 121 to 128 in b71bea4
Before this PR, we can't tune
requestTimeoutMs, which is always 30000s = 5min. See also in:#24879 (comment)
Modifications
Now, we use
ClientConfigurationData.requestTimeoutMsasAsyncHttpConnector.requestTimeoutMs, so we can control the http retry timeout by tuningClientConfigurationData.requestTimeoutMs.AsyncHttpClient get Connector by calling
ConnectorProvider#getConnector(Client client, Configuration runtimeConfig)method.https://github.com/eclipse-ee4j/jersey/blob/bb8a2a1b78e39604f4d283d0176705b143355cce/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java#L465-L467
Both
connectionTimeoutMsandreadTimeoutMsare the same values in jersey properties andClientConfigurationData. See:pulsar/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PulsarAdminImpl.java
Lines 146 to 150 in b71bea4
To ensure code consistency, I would like to suggest using
ClientConfigurationDataand removing jersey config.Side effect: default
requestTimeoutMschanges from 30s to 60s after this PR, which I think is reasonable. If I didn't read the source code, I would assumerequestTimeoutMsis set to 60s, and it would confuse me to find thatrequestTimeoutMsdidn't take effect after I adjusted this value.Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: oneby-wang#11