From 0b25e34ebe426df3f7cde6c98aabc24757704f0a Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 23 Oct 2024 03:08:29 +1100 Subject: [PATCH] fix(headless-client): stop telemetry while `connlib` is active (#7109) Flushing events to Sentry requires us to be able to resolve domain names. This is only possible while connlib is active or completely disabled. Without this, stopping telemetry pretty much always times out for me on my local machine when using the headless-client. --- rust/headless-client/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rust/headless-client/src/main.rs b/rust/headless-client/src/main.rs index ed103aaad..5bacdfe79 100644 --- a/rust/headless-client/src/main.rs +++ b/rust/headless-client/src/main.rs @@ -200,7 +200,7 @@ fn main() -> Result<()> { // The name matches that in `ipc_service.rs` let mut last_connlib_start_instant = Some(Instant::now()); - let result = rt.block_on(async { + rt.block_on(async { let ctx = firezone_telemetry::TransactionContext::new( "connect_to_firezone", "Connecting to Firezone", @@ -325,13 +325,11 @@ fn main() -> Result<()> { tracing::error!(?error, "network notifier"); } + telemetry.stop(); // Stop telemetry before dropping session. `connlib` needs to be active for this, otherwise we won't be able to resolve the DNS name for sentry. session.disconnect(); result - }); - - telemetry.stop(); - result + }) } /// Read the token from disk if it was not in the environment