/// Reboot `updated_instance` with newer image tag
Reboot `updated_instance` with newer image tag
Reboot ` updated_instance ` with newer image tag
pub async fn update_batch_instance(
    context: &mut Context<'_>,
    updated_instance: &[Instance],
    updated_tag: String,
) -> anyhow::Result<()> {
    let deadline = Instant::now() + Duration::from_secs(2 * 60);
    info!("Stop Existing instances.");
    let futures: Vec<_> = updated_instance.iter().map(Instance::stop).collect();
    try_join_all(futures).await?;
    info!("Reinstantiate a set of new nodes.");
    let futures: Vec<_> = updated_instance
        .iter()
        .map(|instance| {
            let mut newer_config = instance.instance_config().clone();
            newer_config.replace_tag(updated_tag.clone()).unwrap();
            context
                .cluster_swarm
                .spawn_new_instance(newer_config, false)
        })
        .collect();
    let instances = try_join_all(futures).await?;
    info!("Wait for the instances to recover.");
    let futures: Vec<_> = instances
        .iter()
        .map(|instance| instance.wait_json_rpc(deadline))
        .collect();
    try_join_all(futures).await?;
    // Add a timeout to have wait for validators back to healthy mode.
    // TODO: Replace this with a blocking health check.
    info!("Wait for the instance to sync up with peers");
    time::delay_for(Duration::from_secs(20)).await;
    Ok(())
}
pub async fn update_batch_instance ( context : & mut Context < ' _ > , updated_instance : & [ Instance ] , updated_tag : String , ) -> anyhow :: Result < ( ) > { let deadline = Instant :: now ( ) + Duration :: from_secs ( 2 * 60 ) ; info ! ( " " ) ; let futures : Vec < _ > = updated_instance . iter ( ) . map ( Instance :: stop ) . collect ( ) ; try_join_all ( futures ) . await ? ; info ! ( " " ) ; let futures : Vec < _ > = updated_instance . iter ( ) . map ( | instance | { let mut newer_config = instance . instance_config ( ) . clone ( ) ; newer_config . replace_tag ( updated_tag . clone ( ) ) . unwrap ( ) ; context . cluster_swarm . spawn_new_instance ( newer_config , false ) } ) . collect ( ) ; let instances = try_join_all ( futures ) . await ? ; info ! ( " " ) ; let futures : Vec < _ > = instances . iter ( ) . map ( | instance | instance . wait_json_rpc ( deadline ) ) . collect ( ) ; try_join_all ( futures ) . await ? ; // Add a timeout to have wait for validators back to healthy mode. // TODO: Replace this with a blocking health check. info ! ( " " ) ; time :: delay_for ( Duration :: from_secs ( 20 ) ) . await ; Ok ( ( ) ) }
Reboot `updated_instance` with newer image tag
Reboot ` updated_instance ` with newer image tag
context
&mut Context<'_>
updated_instance
&[Instance]
updated_tag
String