File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ use serde_json::Value;
5555use std:: {
5656 borrow:: Cow ,
5757 collections:: BTreeMap ,
58- time:: { SystemTime , UNIX_EPOCH } ,
58+ time:: { Duration , SystemTime , UNIX_EPOCH } ,
5959} ;
6060
6161pub mod error;
@@ -384,6 +384,7 @@ pub struct BpxClientBuilder {
384384 ws_url : Option < String > ,
385385 secret : Option < String > ,
386386 headers : Option < BpxHeaders > ,
387+ timeout : Option < u64 > ,
387388}
388389
389390impl BpxClientBuilder {
@@ -444,6 +445,19 @@ impl BpxClientBuilder {
444445 self
445446 }
446447
448+ /// Sets a custom Timeout for the underlying http client
449+ /// If not set, a default of 30 seconds is used.
450+ ///
451+ /// # Arguments
452+ /// * `timeout` - The timeout in seconds
453+ ///
454+ /// # Returns
455+ /// * `Self` - The updated builder instance
456+ pub fn timeout ( mut self , timeout : u64 ) -> Self {
457+ self . timeout = Some ( timeout) ;
458+ self
459+ }
460+
447461 /// Builds the `BpxClient` instance with the configured parameters.
448462 ///
449463 /// # Returns
@@ -489,6 +503,7 @@ impl BpxClientBuilder {
489503 client : reqwest:: Client :: builder ( )
490504 . user_agent ( API_USER_AGENT )
491505 . default_headers ( header_map)
506+ . timeout ( Duration :: from_secs ( self . timeout . unwrap_or ( 30 ) ) )
492507 . build ( ) ?,
493508 } ;
494509
You can’t perform that action at this time.
0 commit comments