Box the managed credential loading future (#62568)

Return a pinned, boxed future from `try_load_managed_auth` so callers
store a pointer to the credential loading future in their async state
machines instead of embedding the full future.

GitOrigin-RevId: 898e4877cc197720d88fc36a566533c5594f4f38
This commit is contained in:
Charlie Marsh
2026-11-19 18:52:23 +00:00
committed by copyberry
parent 65454c7b99
commit 0762dfa710
+9 -1
View File
@@ -3118,7 +3118,15 @@ impl AuthManager {
.map_err(RefreshTokenError::Transient)
}
async fn try_load_managed_auth(
// Keep managed credential loading out of each caller's async state machine.
fn try_load_managed_auth<'a>(
&'a self,
cached_auth: Option<&'a CodexAuth>,
) -> Pin<Box<dyn Future<Output = std::io::Result<Option<CodexAuth>>> + Send + 'a>> {
Box::pin(self.try_load_managed_auth_impl(cached_auth))
}
async fn try_load_managed_auth_impl(
&self,
cached_auth: Option<&CodexAuth>,
) -> std::io::Result<Option<CodexAuth>> {