mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
fix(ServiceAccount): Make cache behavior more intuitive.
Now the cache is only checked for a token when the future is polled, not
at future creation time.
This also allows for reverting c2b41c3.
This commit is contained in:
@@ -25,15 +25,12 @@ fn main() {
|
||||
println!("token is: {:?}", tok);
|
||||
Ok(())
|
||||
});
|
||||
let mut sa2 = sa.clone();
|
||||
let all = fut
|
||||
.then(move |_| {
|
||||
sa2.token(["https://www.googleapis.com/auth/pubsub"].iter())
|
||||
.and_then(|tok| {
|
||||
println!("cached token is {:?} and should be identical", tok);
|
||||
Ok(())
|
||||
})
|
||||
})
|
||||
.then(|_| Ok(()));
|
||||
let fut2 = sa
|
||||
.token(["https://www.googleapis.com/auth/pubsub"].iter())
|
||||
.and_then(|tok| {
|
||||
println!("cached token is {:?} and should be identical", tok);
|
||||
Ok(())
|
||||
});
|
||||
let all = fut.join(fut2).then(|_| Ok(()));
|
||||
tokio::run(all)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user