From cbb9296b729a312ca9ea59ef53cf022994c31dff Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 18 Oct 2017 11:47:10 -0700 Subject: [PATCH] Change the default interval to 5 seconds --- doc/environment_variables.md | 2 +- src/core/ext/filters/client_channel/backup_poller.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 7 ++++--- test/cpp/end2end/end2end_test.cc | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 0163235d63e..40af758f693 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -121,7 +121,7 @@ some configuration as environment variables that can be set. - ares - a DNS resolver based around the c-ares library * GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS - Default: 500 + Default: 5000 Declares the interval between two backup polls on client channels. These polls are run in the timer thread so that gRPC can process connection failures while there is no active polling thread. They help reconnect disconnected client diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index dc1f87bc6c2..e717c4eb7e9 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/src/core/ext/filters/client_channel/backup_poller.cc @@ -31,7 +31,7 @@ #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" -#define DEFAULT_POLL_INTERVAL_MS 500 +#define DEFAULT_POLL_INTERVAL_MS 5000 typedef struct backup_poller { grpc_timer polling_timer; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index f8ad4c333c1..af3bdb25ac7 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -461,6 +461,7 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) { if (GetParam().inproc) { return; } + gpr_setenv("GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS", "200"); int poller_slowdown_factor = 1; // It needs 2 pollset_works to reconnect the channel with polling engine // "poll" @@ -478,12 +479,12 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) { while (cq_->Next(&ignored_tag, &ignored_ok)) ; BuildAndStartServer(); - // It needs more than kConnectivityCheckIntervalMsec time to reconnect the - // channel. + // It needs more than GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS time to + // reconnect the channel. gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis( - 600 * poller_slowdown_factor * grpc_test_slowdown_factor(), + 300 * poller_slowdown_factor * grpc_test_slowdown_factor(), GPR_TIMESPAN))); SendRpc(1); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 2272c9945ee..82ca39466ef 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -706,6 +706,7 @@ TEST_P(End2endTest, ReconnectChannel) { if (GetParam().inproc) { return; } + gpr_setenv("GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS", "200"); int poller_slowdown_factor = 1; // It needs 2 pollset_works to reconnect the channel with polling engine // "poll" @@ -717,12 +718,12 @@ TEST_P(End2endTest, ReconnectChannel) { ResetStub(); SendRpc(stub_.get(), 1, false); RestartServer(std::shared_ptr()); - // It needs more than kConnectivityCheckIntervalMsec time to reconnect the - // channel. + // It needs more than GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS time to + // reconnect the channel. gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis( - 600 * poller_slowdown_factor * grpc_test_slowdown_factor(), + 300 * poller_slowdown_factor * grpc_test_slowdown_factor(), GPR_TIMESPAN))); SendRpc(stub_.get(), 1, false); }