// Attempt to get the component list `NUM_ATTEMPTS` times. If all attempts fail, return the
// last error encountered.
//
// This fixes an issue (fxbug.dev/84805) where the component topology may be mutating while the
// hub is being traversed, resulting in failures.
Attempt to get the component list `NUM_ATTEMPTS` times. If all attempts fail, return the
last error encountered.

This fixes an issue (fxbug.dev/84805) where the component topology may be mutating while the
hub is being traversed, resulting in failures.
Attempt to get the component list ` NUM_ATTEMPTS ` times . If all attempts fail return the last error encountered . This fixes an issue ( fxbug . dev / 84805 ) where the component topology may be mutating while the hub is being traversed resulting in failures .
pub async fn try_get_component_list(hub_dir: Directory) -> Result<Component> {
    let mut attempt_number = 1;
    loop {
        match Component::parse("/".to_string(), hub_dir.clone()).await {
            Ok(component) => return Ok(component),
            Err(e) => {
                if attempt_number > NUM_ATTEMPTS {
                    return Err(e);
                } else {
                    eprintln!("Retrying. Attempt #{} failed: {}", attempt_number, e);
                }
            }
        }
        attempt_number += 1;
    }
}
pub async fn try_get_component_list ( hub_dir : Directory ) -> Result < Component > { let mut attempt_number = 1 ; loop { match Component :: parse ( " " . to_string ( ) , hub_dir . clone ( ) ) . await { Ok ( component ) => return Ok ( component ) , Err ( e ) => { if attempt_number > NUM_ATTEMPTS { return Err ( e ) ; } else { eprintln ! ( " " attempt_number e ) ; } } } attempt_number += 1 ; } }
Attempt to get the component list `NUM_ATTEMPTS` times.
Attempt to get the component list ` NUM_ATTEMPTS ` times .
hub_dir
Directory