File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ use serde_json::Value;
5454use std:: {
5555 borrow:: Cow ,
5656 collections:: BTreeMap ,
57- time:: { SystemTime , UNIX_EPOCH } ,
57+ time:: { Duration , SystemTime , UNIX_EPOCH } ,
5858} ;
5959
6060pub mod error;
@@ -335,6 +335,7 @@ pub struct BpxClientBuilder {
335335 ws_url : Option < String > ,
336336 secret : Option < String > ,
337337 headers : Option < BpxHeaders > ,
338+ timeout : Option < u64 > ,
338339}
339340
340341impl BpxClientBuilder {
@@ -395,6 +396,19 @@ impl BpxClientBuilder {
395396 self
396397 }
397398
399+ /// Sets a custom Timeout for the underlying http client
400+ /// If not set, a default of 30 seconds is used.
401+ ///
402+ /// # Arguments
403+ /// * `timeout` - The timeout in seconds
404+ ///
405+ /// # Returns
406+ /// * `Self` - The updated builder instance
407+ pub fn timeout ( mut self , timeout : u64 ) -> Self {
408+ self . timeout = Some ( timeout) ;
409+ self
410+ }
411+
398412 /// Builds the `BpxClient` instance with the configured parameters.
399413 ///
400414 /// # Returns
@@ -440,6 +454,7 @@ impl BpxClientBuilder {
440454 client : reqwest:: Client :: builder ( )
441455 . user_agent ( API_USER_AGENT )
442456 . default_headers ( header_map)
457+ . timeout ( Duration :: from_secs ( self . timeout . unwrap_or ( 30 ) ) )
443458 . build ( ) ?,
444459 } ;
445460
You can’t perform that action at this time.
0 commit comments