@@ -1883,6 +1883,7 @@ async fn main() {
18831883 const RUST_BACKTRACE : & str = "RUST_BACKTRACE" ;
18841884 const RECONNECT_RATE_LIMIT_WINDOW : Duration = Duration :: from_secs ( 600 ) ;
18851885 const DISCOVERY_RETRY_TIMEOUT : Duration = Duration :: from_secs ( 10 ) ;
1886+ const DISCOVERY_RETRY_UPTIME_LIMIT : Duration = Duration :: from_secs ( 60 ) ;
18861887 const RECONNECT_RATE_LIMIT : usize = 5 ;
18871888
18881889 if env:: var ( RUST_BACKTRACE ) . is_err ( ) {
@@ -1910,8 +1911,8 @@ async fn main() {
19101911 // network-online.target but it requires that a wait-online.service is
19111912 // also enabled which is not always the case since a wait-online.service
19121913 // can potentially hang the boot process until it times out in certain situations.
1913- // This allows for discovery to retry every 10 secs in the 1st min of uptime
1914- // before giving up thus papering over the issue and not holding up the boot process.
1914+ // This allows for discovery to do periodic retries for an amount of time after system
1915+ // startup before giving up thus papering over the issue and not holding up the boot process.
19151916
19161917 discovery = loop {
19171918 let device_id = setup. session_config . device_id . clone ( ) ;
@@ -1930,11 +1931,14 @@ async fn main() {
19301931 Err ( e) => {
19311932 sys. refresh_processes ( ProcessesToUpdate :: All , true ) ;
19321933
1933- if System :: uptime ( ) <= 1 {
1934+ if Duration :: from_secs ( System :: uptime ( ) ) <= DISCOVERY_RETRY_UPTIME_LIMIT {
19341935 debug ! ( "Retrying to initialise discovery: {e}" ) ;
19351936 tokio:: time:: sleep ( DISCOVERY_RETRY_TIMEOUT ) . await ;
19361937 } else {
1937- debug ! ( "System uptime > 1 min, not retrying to initialise discovery" ) ;
1938+ debug ! (
1939+ "System uptime > {} secs, not retrying to initialise discovery" ,
1940+ DISCOVERY_RETRY_UPTIME_LIMIT . as_secs( )
1941+ ) ;
19381942 warn ! ( "Could not initialise discovery: {e}" ) ;
19391943 break None ;
19401944 }
0 commit comments