-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add connection timeout client configuration option #2852
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
Conversation
Allows the client to specify how long to wait for brokers to respond.
|
run integration tests |
1 similar comment
|
run integration tests |
|
rerun integration tests |
pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
Show resolved
Hide resolved
| .connectionTimeout(24, TimeUnit.HOURS).build()) { | ||
| CompletableFuture<Producer<byte[]>> f = client.newProducer().topic("foo").createAsync(); | ||
|
|
||
| Thread.sleep(12000); // sleep for 12 seconds (default timeout is 10) |
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.
Can we reduce the default timeout and change the sleep here?
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.
Changing the default timeout is a behavioral change. Currently, it's 10 seconds hardcoded. It does suck that it added 12 seconds to all test runs. A better option would be to disable or just remove this test.
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.
can we make the timeout configurable and reduce it in the test?
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.
this whole patch is making the timeout configurable. this test is to check that times configured more than the default take effect. I think the easiest would be to just remove this test. Testing that is takes effect is already tested by the other test.
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.
sgtm
pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java
Show resolved
Hide resolved
|
run integration tests |
|
rerun integration tests |
|
rerun java8 tests |
Fixes #10747 ### Motivation This PR is a catchup of #2852 and adds connection timeout configuration to C++ and Python client. ### Modifications - Add a `PeriodicTask` class to execute tasks periodically and the relate unit tests: `PeriodicTastTest`. - Use `PeriodicTask` to register a timer before connecting to broker asynchronously, if the connection was not established when the timer is triggered, close the socket so that `handleTcpConnected` can be triggered immediately with a failure. - Add connection timeout (in milliseconds) to both C++ and Python clients. - Add `ClientTest.testConnectTimeout` (C++) and `test_connect_timeout` (Python) and to verify the connection timeout works. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: - PeriodicTaskTest - ClientTest.testConnectTimeout - test_connect_timeout
Fixes #10747 ### Motivation This PR is a catchup of #2852 and adds connection timeout configuration to C++ and Python client. ### Modifications - Add a `PeriodicTask` class to execute tasks periodically and the relate unit tests: `PeriodicTastTest`. - Use `PeriodicTask` to register a timer before connecting to broker asynchronously, if the connection was not established when the timer is triggered, close the socket so that `handleTcpConnected` can be triggered immediately with a failure. - Add connection timeout (in milliseconds) to both C++ and Python clients. - Add `ClientTest.testConnectTimeout` (C++) and `test_connect_timeout` (Python) and to verify the connection timeout works. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: - PeriodicTaskTest - ClientTest.testConnectTimeout - test_connect_timeout (cherry picked from commit 6062d2f)
Fixes apache#10747 ### Motivation This PR is a catchup of apache#2852 and adds connection timeout configuration to C++ and Python client. ### Modifications - Add a `PeriodicTask` class to execute tasks periodically and the relate unit tests: `PeriodicTastTest`. - Use `PeriodicTask` to register a timer before connecting to broker asynchronously, if the connection was not established when the timer is triggered, close the socket so that `handleTcpConnected` can be triggered immediately with a failure. - Add connection timeout (in milliseconds) to both C++ and Python clients. - Add `ClientTest.testConnectTimeout` (C++) and `test_connect_timeout` (Python) and to verify the connection timeout works. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: - PeriodicTaskTest - ClientTest.testConnectTimeout - test_connect_timeout
Fixes #10747 ### Motivation This PR is a catchup of apache/pulsar#2852 and adds connection timeout configuration to C++ and Python client. ### Modifications - Add a `PeriodicTask` class to execute tasks periodically and the relate unit tests: `PeriodicTastTest`. - Use `PeriodicTask` to register a timer before connecting to broker asynchronously, if the connection was not established when the timer is triggered, close the socket so that `handleTcpConnected` can be triggered immediately with a failure. - Add connection timeout (in milliseconds) to both C++ and Python clients. - Add `ClientTest.testConnectTimeout` (C++) and `test_connect_timeout` (Python) and to verify the connection timeout works. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: - PeriodicTaskTest - ClientTest.testConnectTimeout - test_connect_timeout
Allows the client to specify how long to wait for brokers to respond.