@@ -156,6 +156,7 @@ pub struct Agent {
156
156
concurrent_requests_semaphore : Arc < Semaphore > ,
157
157
verify_query_signatures : bool ,
158
158
max_response_body_size : Option < usize > ,
159
+ max_polling_time : Duration ,
159
160
#[ allow( dead_code) ]
160
161
max_tcp_error_retries : usize ,
161
162
}
@@ -208,6 +209,7 @@ impl Agent {
208
209
concurrent_requests_semaphore : Arc :: new ( Semaphore :: new ( config. max_concurrent_requests ) ) ,
209
210
max_response_body_size : config. max_response_body_size ,
210
211
max_tcp_error_retries : config. max_tcp_error_retries ,
212
+ max_polling_time : config. max_polling_time ,
211
213
} )
212
214
}
213
215
@@ -615,12 +617,12 @@ impl Agent {
615
617
} )
616
618
}
617
619
618
- fn get_retry_policy ( ) -> ExponentialBackoff < SystemClock > {
620
+ fn get_retry_policy ( & self ) -> ExponentialBackoff < SystemClock > {
619
621
ExponentialBackoffBuilder :: new ( )
620
622
. with_initial_interval ( Duration :: from_millis ( 500 ) )
621
623
. with_max_interval ( Duration :: from_secs ( 1 ) )
622
624
. with_multiplier ( 1.4 )
623
- . with_max_elapsed_time ( Some ( Duration :: from_secs ( 60 * 5 ) ) )
625
+ . with_max_elapsed_time ( Some ( self . max_polling_time ) )
624
626
. build ( )
625
627
}
626
628
@@ -631,7 +633,7 @@ impl Agent {
631
633
effective_canister_id : Principal ,
632
634
signed_request_status : Vec < u8 > ,
633
635
) -> Result < Vec < u8 > , AgentError > {
634
- let mut retry_policy = Self :: get_retry_policy ( ) ;
636
+ let mut retry_policy = self . get_retry_policy ( ) ;
635
637
636
638
let mut request_accepted = false ;
637
639
loop {
@@ -679,7 +681,7 @@ impl Agent {
679
681
request_id : & RequestId ,
680
682
effective_canister_id : Principal ,
681
683
) -> Result < Vec < u8 > , AgentError > {
682
- let mut retry_policy = Self :: get_retry_policy ( ) ;
684
+ let mut retry_policy = self . get_retry_policy ( ) ;
683
685
684
686
let mut request_accepted = false ;
685
687
loop {
0 commit comments