File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1- use std:: sync:: Arc ;
1+ use std:: { sync:: Arc , time :: Duration } ;
22
33use anyhow:: anyhow;
44use derive_new:: new;
@@ -13,7 +13,8 @@ use ic_bn_lib::ic_agent::agent::{
1313 } ,
1414} ;
1515use ic_bn_lib_common:: { principal, traits:: Healthy } ;
16- use tracing:: info;
16+ use tokio:: time:: { sleep, timeout} ;
17+ use tracing:: { info, warn} ;
1718use url:: Url ;
1819
1920use crate :: {
@@ -96,5 +97,17 @@ pub async fn setup_route_provider(
9697 Arc :: new ( RoundRobinRouteProvider :: new ( urls_str) ?)
9798 } ;
9899
100+ let wrapper = RouteProviderWrapper :: new ( route_provider. clone ( ) ) ;
101+ if timeout ( Duration :: from_secs ( 120 ) , async {
102+ while !wrapper. healthy ( ) {
103+ sleep ( Duration :: from_secs ( 1 ) ) . await ;
104+ }
105+ } )
106+ . await
107+ . is_err ( )
108+ {
109+ warn ! ( "Route provider did not become healthy within 2 minutes, continuing anyway" ) ;
110+ }
111+
99112 Ok ( route_provider)
100113}
You can’t perform that action at this time.
0 commit comments