@@ -287,15 +287,7 @@ impl Daemon {
287287 }
288288
289289 pub async fn try_start ( & mut self , host : String , app_handle : & AppHandle ) {
290- if !self . should_retry ( ) {
291- self . try_notify_failed ( app_handle) ;
292- return ;
293- }
294- info ! (
295- "[{}] attempting to start daemon ({}/10)" ,
296- host, self . retry_count
297- ) ;
298- self . retry_count += 1 ;
290+ info ! ( "[{}] attempting to start daemon" , host) ;
299291 if let Some ( _) = self . command {
300292 self . try_stop ( ) . await ;
301293 }
@@ -322,11 +314,20 @@ impl Daemon {
322314 self . status = daemon:: DaemonStatus :: default ( ) ;
323315 }
324316
325- fn should_retry ( & self ) -> bool {
317+ fn should_retry ( & mut self , app_handle : & AppHandle ) -> bool {
326318 if self . status . login_required {
327319 return false ;
328320 }
329- return self . retry_count <= MAX_RETRY_COUNT ;
321+
322+ self . retry_count += 1 ;
323+ if self . retry_count < MAX_RETRY_COUNT {
324+ return true ;
325+ } else {
326+ self . try_notify_failed ( app_handle) ;
327+
328+ // fall back to every 5 ticks after reaching `MAX_RETRY_COUNT`
329+ return self . retry_count % 5 == 0 ;
330+ }
330331 }
331332
332333 fn should_debug ( & self ) -> bool {
@@ -489,7 +490,7 @@ async fn watch_daemons(app_handle: &AppHandle) -> anyhow::Result<()> {
489490 ) ;
490491 }
491492 let daemon = instance. daemon . as_mut ( ) . unwrap ( ) ;
492- if !daemon. should_retry ( ) {
493+ if !daemon. should_retry ( app_handle ) {
493494 all_ready = false ;
494495 continue ;
495496 }
0 commit comments