diff --git a/Cargo.lock b/Cargo.lock index a5f91b1..85ed6c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "actix" version = "0.10.0" @@ -1396,7 +1398,7 @@ dependencies = [ [[package]] name = "microtools" -version = "0.3.3" +version = "0.3.4" dependencies = [ "actix", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 8833012..d24aa71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "microtools" -version = "0.3.3" +version = "0.3.4" authors = ["Bodo Junglas ", "Ihor Mordashev cargo fmt -- --check && cargo clippy && cargo test \ No newline at end of file diff --git a/src/service_requester.rs b/src/service_requester.rs index 05e3609..d7eee42 100644 --- a/src/service_requester.rs +++ b/src/service_requester.rs @@ -36,10 +36,18 @@ pub struct ServiceRequester { impl ServiceRequester { pub fn with_service_auth(service_name: &str, scopes: &[(&str, &[&str])]) -> BusinessResult { + ServiceRequester::with_service_auth_with_timeout(service_name, scopes, 120) + } + + pub fn with_service_auth_with_timeout( + service_name: &str, + scopes: &[(&str, &[&str])], + timeout_seconds: u16, + ) -> BusinessResult { Ok(ServiceRequester { client: Client::builder() - .connect_timeout(Duration::from_secs(20)) - .timeout(Duration::from_secs(60)) + .connect_timeout(Duration::from_secs(timeout_seconds as u64)) + .timeout(Duration::from_secs(timeout_seconds as u64)) .redirect(Policy::none()) .build()?, token_creator: TokenCreator::for_service(service_name, scopes).start(),