Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/perms/oauth.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())
}
}

Expand Down
Loading