Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from 21re/timeouts
Browse files Browse the repository at this point in the history
Timeouts
  • Loading branch information
Ihor authored Jun 24, 2021
2 parents e445b5d + b506507 commit 746e853
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "microtools"
version = "0.3.3"
version = "0.3.4"
authors = ["Bodo Junglas <[email protected]>", "Ihor Mordashev <[email protected]"]
edition = "2018"

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# microtools-rs
Minimal toolbox to write backend services in rust

## Test & Check

> cargo fmt -- --check && cargo clippy && cargo test
12 changes: 10 additions & 2 deletions src/service_requester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ pub struct ServiceRequester {

impl ServiceRequester {
pub fn with_service_auth(service_name: &str, scopes: &[(&str, &[&str])]) -> BusinessResult<Self> {
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<Self> {
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(),
Expand Down

0 comments on commit 746e853

Please sign in to comment.