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
13 changes: 4 additions & 9 deletions objectstore-service/src/gcp_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use std::time::Duration;
use async_trait::async_trait;
use chrono::Utc;
use tokio::sync::watch;
use tokio::task::JoinHandle;
use tokio::time::Instant;
use tokio_util::task::AbortOnDropHandle;

/// How far ahead of expiry to start refreshing.
///
Expand Down Expand Up @@ -82,13 +82,8 @@ pub struct PrefetchingTokenProvider {
scopes: Vec<&'static str>,
rx: watch::Receiver<TokenResult>,
provider: Arc<dyn gcp_auth::TokenProvider>,
task: JoinHandle<()>,
}

impl Drop for PrefetchingTokenProvider {
fn drop(&mut self) {
self.task.abort();
}
/// Aborts the background refresh task when the provider is dropped.
_task: AbortOnDropHandle<()>,
}

impl std::fmt::Debug for PrefetchingTokenProvider {
Expand Down Expand Up @@ -128,7 +123,7 @@ impl PrefetchingTokenProvider {
scopes: scopes.to_vec(),
rx,
provider,
task,
_task: AbortOnDropHandle::new(task),
})
}
}
Expand Down
Loading