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.
This commit is contained in:
Thomas Eizinger
2024-10-23 03:08:29 +11:00
committed by GitHub
parent 13b7c11d76
commit 0b25e34ebe

View File

@@ -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