Skip to content

Commit

Permalink
add pool_idle_timeout option to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
HerveHuneau committed Nov 25, 2024
1 parent ae5d103 commit 773a8b1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::Arc;
use std::{sync::Arc, time::Duration};

use reqwest::Url;
use reqwest_middleware::Middleware;
Expand Down Expand Up @@ -66,6 +66,19 @@ impl BridgeBuilderInner<reqwest::ClientBuilder> {
}
}

/// Set an optional timeout for idle sockets being kept-alive.
///
/// Pass `None` to disable timeout.
///
/// Default is 90 seconds.
pub fn with_pool_idle_timeout(self, max: Option<Duration>) -> Self {
Self {
inner: self.inner.pool_idle_timeout(max),
#[cfg(feature = "auth0")]
auth0: self.auth0,
}
}

pub fn with_middleware(self, layer: impl Middleware) -> BridgeBuilderInner<reqwest_middleware::ClientBuilder> {
let client = self.inner.build().expect("Unable to create Bridge");
BridgeBuilderInner {
Expand Down

0 comments on commit 773a8b1

Please sign in to comment.