diff --git a/src/core/client_channel/backup_poller.cc b/src/core/client_channel/backup_poller.cc index 43b485dc7ef..973df54ee46 100644 --- a/src/core/client_channel/backup_poller.cc +++ b/src/core/client_channel/backup_poller.cc @@ -57,8 +57,19 @@ static backup_poller* g_poller = nullptr; // guarded by g_poller_mu // treated as const. static grpc_core::Duration g_poll_interval = grpc_core::Duration::Milliseconds(DEFAULT_POLL_INTERVAL_MS); +// TODO(hork): delete the backup poller when EventEngine is rolled out +// everywhere. +static bool g_backup_polling_disabled; void grpc_client_channel_global_init_backup_polling() { + // Disable backup polling if EventEngine is used everywhere. + g_backup_polling_disabled = grpc_core::IsEventEngineClientEnabled() && + grpc_core::IsEventEngineListenerEnabled() && + grpc_core::IsEventEngineDnsEnabled(); + if (g_backup_polling_disabled) { + return; + } + gpr_mu_init(&g_poller_mu); int32_t poll_interval_ms = grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs(); @@ -146,7 +157,8 @@ static void g_poller_init_locked() { void grpc_client_channel_start_backup_polling( grpc_pollset_set* interested_parties) { - if (g_poll_interval == grpc_core::Duration::Zero() || + if (g_backup_polling_disabled || + g_poll_interval == grpc_core::Duration::Zero() || grpc_iomgr_run_in_background()) { return; } @@ -165,7 +177,8 @@ void grpc_client_channel_start_backup_polling( void grpc_client_channel_stop_backup_polling( grpc_pollset_set* interested_parties) { - if (g_poll_interval == grpc_core::Duration::Zero() || + if (g_backup_polling_disabled || + g_poll_interval == grpc_core::Duration::Zero() || grpc_iomgr_run_in_background()) { return; }