diff options
-rw-r--r-- | src/core/ext/filters/client_channel/backup_poller.cc | 4 | ||||
-rw-r--r-- | test/cpp/end2end/async_end2end_test.cc | 14 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 14 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index 3b47b6630b..dc1f87bc6c 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/src/core/ext/filters/client_channel/backup_poller.cc @@ -113,8 +113,8 @@ static void run_poller(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { backup_poller_shutdown_unref(exec_ctx, p); return; } - grpc_error* err = - grpc_pollset_work(exec_ctx, p->pollset, NULL, GRPC_MILLIS_INF_PAST); + grpc_error* err = grpc_pollset_work(exec_ctx, p->pollset, NULL, + grpc_exec_ctx_now(exec_ctx)); gpr_mu_unlock(p->pollset_mu); GRPC_LOG_IF_ERROR("Run client channel backup poller", err); grpc_timer_init(exec_ctx, &p->polling_timer, diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 4d1beb1d1d..f8ad4c333c 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -28,12 +28,14 @@ #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/tls.h> #include "src/core/lib/iomgr/port.h" +#include "src/core/lib/support/env.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -459,6 +461,14 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) { if (GetParam().inproc) { return; } + int poller_slowdown_factor = 1; + // It needs 2 pollset_works to reconnect the channel with polling engine + // "poll" + char* s = gpr_getenv("GRPC_POLL_STRATEGY"); + if (s != NULL && 0 == strcmp(s, "poll")) { + poller_slowdown_factor = 2; + } + gpr_free(s); ResetStub(); SendRpc(1); server_->Shutdown(); @@ -472,7 +482,9 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) { // channel. gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_millis(600 * grpc_test_slowdown_factor(), GPR_TIMESPAN))); + gpr_time_from_millis( + 600 * 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 73f5555539..2272c9945e 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -30,11 +30,13 @@ #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include "src/core/lib/security/credentials/credentials.h" +#include "src/core/lib/support/env.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -704,6 +706,14 @@ TEST_P(End2endTest, ReconnectChannel) { if (GetParam().inproc) { return; } + int poller_slowdown_factor = 1; + // It needs 2 pollset_works to reconnect the channel with polling engine + // "poll" + char* s = gpr_getenv("GRPC_POLL_STRATEGY"); + if (s != NULL && 0 == strcmp(s, "poll")) { + poller_slowdown_factor = 2; + } + gpr_free(s); ResetStub(); SendRpc(stub_.get(), 1, false); RestartServer(std::shared_ptr<AuthMetadataProcessor>()); @@ -711,7 +721,9 @@ TEST_P(End2endTest, ReconnectChannel) { // channel. gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_millis(600 * grpc_test_slowdown_factor(), GPR_TIMESPAN))); + gpr_time_from_millis( + 600 * poller_slowdown_factor * grpc_test_slowdown_factor(), + GPR_TIMESPAN))); SendRpc(stub_.get(), 1, false); } |