[EventEngine] Disable the backup poller if all EventEngine experiments are running (#37951)

Closes #37951

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37951 from drfloob:disable-backup-poller 1ce9d2d1d6
PiperOrigin-RevId: 688263398
pull/37985/head
AJ Heller 1 month ago committed by Copybara-Service
parent 4662017636
commit 14f22c7fd7
  1. 17
      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. // treated as const.
static grpc_core::Duration g_poll_interval = static grpc_core::Duration g_poll_interval =
grpc_core::Duration::Milliseconds(DEFAULT_POLL_INTERVAL_MS); 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() { 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); gpr_mu_init(&g_poller_mu);
int32_t poll_interval_ms = int32_t poll_interval_ms =
grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs(); grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs();
@ -146,7 +157,8 @@ static void g_poller_init_locked() {
void grpc_client_channel_start_backup_polling( void grpc_client_channel_start_backup_polling(
grpc_pollset_set* interested_parties) { 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()) { grpc_iomgr_run_in_background()) {
return; return;
} }
@ -165,7 +177,8 @@ void grpc_client_channel_start_backup_polling(
void grpc_client_channel_stop_backup_polling( void grpc_client_channel_stop_backup_polling(
grpc_pollset_set* interested_parties) { 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()) { grpc_iomgr_run_in_background()) {
return; return;
} }

Loading…
Cancel
Save