fix(test-svc-acct): Non-lazy cache lookup resulted in two requests.

This commit is contained in:
Lewin Bormann
2019-06-21 11:12:59 +02:00
parent 5e76c2258f
commit c2b41c3da2

View File

@@ -25,12 +25,15 @@ fn main() {
println!("token is: {:?}", tok); println!("token is: {:?}", tok);
Ok(()) Ok(())
}); });
let fut2 = sa let mut sa2 = sa.clone();
.token(["https://www.googleapis.com/auth/pubsub"].iter()) let all = fut
.and_then(|tok| { .then(move |_| {
println!("cached token is {:?} and should be identical", tok); sa2.token(["https://www.googleapis.com/auth/pubsub"].iter())
Ok(()) .and_then(|tok| {
}); println!("cached token is {:?} and should be identical", tok);
let all = fut.join(fut2).then(|_| Ok(())); Ok(())
})
})
.then(|_| Ok(()));
tokio::run(all) tokio::run(all)
} }