From 14f22c7fd7af7a589623b94353c00de873a6f7b6 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Mon, 21 Oct 2024 14:00:01 -0700 Subject: [PATCH] [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 1ce9d2d1d64d4e52e4b8e20259a86c6f443ee947 PiperOrigin-RevId: 688263398 --- src/core/client_channel/backup_poller.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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; }