/// Cancels all rebuilds jobs associated with the child
/// If any job is found with the child as a destination then the job is
/// stopped. If any job is found with the child as a source then
/// the job is replaced with a new one with another healthy child
/// as src, if found
/// todo: how to proceed if no healthy child is found?
Cancels all rebuilds jobs associated with the child
If any job is found with the child as a destination then the job is
stopped.
Cancels all rebuilds jobs associated with the child If any job is found with the child as a destination then the job is stopped .
pub async fn cancel_child_rebuild_jobs(&mut self, name: &str) {
        let mut src_jobs = self.get_rebuild_job_src(name);
        let mut replace_jobs = Vec::new();
        // terminates all jobs with the child as a source
        src_jobs.iter_mut().for_each(|j| {
            replace_jobs
                .push((j.destination.clone(), j.as_client().terminate()));
        });
        for job in replace_jobs {
            // before we can start a new rebuild we need to wait
            // for the previous rebuild to complete
            if let Err(e) = job.1.await {
                error!("Error {} when waiting for the job to terminate", e);
            }
            if let Err(e) = self.start_rebuild(&job.0).await {
                error!("Failed to recreate rebuild: {}", e.verbose());
            }
        }
        // terminates the only possible job with the child as a destination
        self.terminate_rebuild(name);
    }
pub async fn cancel_child_rebuild_jobs ( & mut self , name : & str ) { let mut src_jobs = self . get_rebuild_job_src ( name ) ; let mut replace_jobs = Vec :: new ( ) ; // terminates all jobs with the child as a source src_jobs . iter_mut ( ) . for_each ( | j | { replace_jobs . push ( ( j . destination . clone ( ) , j . as_client ( ) . terminate ( ) ) ) ; } ) ; for job in replace_jobs { // before we can start a new rebuild we need to wait // for the previous rebuild to complete if let Err ( e ) = job . 1 . await { error ! ( " " e ) ; } if let Err ( e ) = self . start_rebuild ( & job . 0 ) . await { error ! ( " " e verbose ( ) ) ; } } // terminates the only possible job with the child as a destination self . terminate_rebuild ( name ) ; }
Cancels all rebuilds jobs associated with the child
If any job is found with the child as a destination then the job is
stopped.
Cancels all rebuilds jobs associated with the child If any job is found with the child as a destination then the job is stopped .
&mut self
name
&str