async fn wait_till_volume(volume: &VolumeId, replicas: usize) {
    let timeout = Duration::from_secs(RECONCILE_TIMEOUT_SECS);
    let start = std::time::Instant::now();
    loop {
        // the volume state does not carry replica information, so inspect the replica spec instead.
        let specs = GetSpecs::default().request().await.unwrap();
        let replica_specs = specs
            .replicas
            .iter()
            .filter(|r| r.owners.owned_by(volume))
            .collect::<Vec<_>>();

        if replica_specs.len() == replicas {
            return;
        }
        if std::time::Instant::now() > (start + timeout) {
            panic!(
                "Timeout waiting for the volume to reach the specified replica ('{}'), current: '{}'",
                replicas, replica_specs.len()
            );
        }
        tokio::time::sleep(Duration::from_secs(1)).await;
    }
}
/// Wait for the unpublished volume to have the specified replica count
Wait for the unpublished volume to have the specified replica count
Wait for the unpublished volume to have the specified replica count
async fn wait_till_volume(volume: &VolumeId, replicas: usize) {
    let timeout = Duration::from_secs(RECONCILE_TIMEOUT_SECS);
    let start = std::time::Instant::now();
    loop {
        // the volume state does not carry replica information, so inspect the replica spec instead.
        let specs = GetSpecs::default().request().await.unwrap();
        let replica_specs = specs
            .replicas
            .iter()
            .filter(|r| r.owners.owned_by(volume))
            .collect::<Vec<_>>();
        if replica_specs.len() == replicas {
            return;
        }
        if std::time::Instant::now() > (start + timeout) {
            panic!(
                "Timeout waiting for the volume to reach the specified replica ('{}'), current: '{}'",
                replicas, replica_specs.len()
            );
        }
        tokio::time::sleep(Duration::from_secs(1)).await;
    }
}
async fn wait_till_volume ( volume : & VolumeId , replicas : usize ) { let timeout = Duration :: from_secs ( RECONCILE_TIMEOUT_SECS ) ; let start = std :: time :: Instant :: now ( ) ; loop { // the volume state does not carry replica information, so inspect the replica spec instead. let specs = GetSpecs :: default ( ) . request ( ) . await . unwrap ( ) ; let replica_specs = specs . replicas . iter ( ) . filter ( | r | r . owners . owned_by ( volume ) ) . collect :: < Vec < _ > > ( ) ; if replica_specs . len ( ) == replicas { return ; } if std :: time :: Instant :: now ( ) > ( start + timeout ) { panic ! ( " " replicas replica_specs len ( ) ) ; } tokio :: time :: sleep ( Duration :: from_secs ( 1 ) ) . await ; } }
Wait for the unpublished volume to have the specified replica count
Wait for the unpublished volume to have the specified replica count
volume
&VolumeId
replicas
usize
volume
&VolumeId
replicas
usize