From 9b18e713e1d661b5e6a57029a213e39ed3825db9 Mon Sep 17 00:00:00 2001 From: Fraser Hutchison <190532+Fraser999@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:11:57 +0100 Subject: [PATCH] remove long-running oauth task from current span --- src/perms/oauth.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/perms/oauth.rs b/src/perms/oauth.rs index 52c07ab..5f28be9 100644 --- a/src/perms/oauth.rs +++ b/src/perms/oauth.rs @@ -1,7 +1,9 @@ //! Service responsible for authenticating with the cache with Oauth tokens. //! This authenticator periodically fetches a new token every set amount of seconds. +#[cfg(doc)] +use crate::deps::tracing::Instrument; use crate::{ - deps::tracing::{debug, warn, Instrument}, + deps::tracing::{debug, warn}, utils::from_env::FromEnv, }; use core::fmt; @@ -69,11 +71,10 @@ impl OAuthConfig { /// active [`SharedToken`]s via a [`tokio::sync::watch`] channel. /// /// This task can be spawned using the [`Authenticator::spawn`] method, which -/// will create a new tokio task that runs the refresh loop in the background, -/// in the current [`tracing`] span. Alternately, the [`IntoFuture`] -/// implementation can be used to create a future that runs the refresh loop, -/// and can be isntrumented with the [`Instrument`] trait, and then spawned or -/// awaited as desired. +/// will create a new tokio task that runs the refresh loop in the background. +/// Alternately, the [`IntoFuture`] implementation can be used to create a +/// future that runs the refresh loop, and can be instrumented with the +/// [`Instrument`] trait, and then spawned or awaited as desired. #[derive(Debug)] pub struct Authenticator { /// Configuration @@ -190,7 +191,7 @@ impl Authenticator { /// interval may be configured via the /// [`OAuthConfig::oauth_token_refresh_interval`] property. pub fn spawn(self) -> JoinHandle<()> { - tokio::spawn(self.task_future().in_current_span()) + tokio::spawn(self.task_future()) } }