pub async fn wait_workers_stops(&mut self) -> CollectionResult<()> {
        let maybe_handle = self.update_worker.take();
        if let Some(handle) = maybe_handle {
            handle.await?;
        }
        let maybe_handle = self.optimizer_worker.take();
        if let Some(handle) = maybe_handle {
            handle.await?;
        }

        let mut opt_handles_guard = self.optimization_handles.lock().await;
        let opt_handles = std::mem::take(&mut *opt_handles_guard);
        let stopping_handles = opt_handles.into_iter().map(|h| h.stop()).collect_vec();

        for res in stopping_handles {
            res.await?;
        }

        Ok(())
    }
/// Gracefully wait before all optimizations stop
/// If some optimization is in progress - it will be finished before shutdown.
Gracefully wait before all optimizations stop
If some optimization is in progress - it will be finished before shutdown.
Gracefully wait before all optimizations stop If some optimization is in progress - it will be finished before shutdown .
pub async fn wait_workers_stops(&mut self) -> CollectionResult<()> {
        let maybe_handle = self.update_worker.take();
        if let Some(handle) = maybe_handle {
            handle.await?;
        }
        let maybe_handle = self.optimizer_worker.take();
        if let Some(handle) = maybe_handle {
            handle.await?;
        }
        let mut opt_handles_guard = self.optimization_handles.lock().await;
        let opt_handles = std::mem::take(&mut *opt_handles_guard);
        let stopping_handles = opt_handles.into_iter().map(|h| h.stop()).collect_vec();
        for res in stopping_handles {
            res.await?;
        }
        Ok(())
    }
pub async fn wait_workers_stops ( & mut self ) -> CollectionResult < ( ) > { let maybe_handle = self . update_worker . take ( ) ; if let Some ( handle ) = maybe_handle { handle . await ? ; } let maybe_handle = self . optimizer_worker . take ( ) ; if let Some ( handle ) = maybe_handle { handle . await ? ; } let mut opt_handles_guard = self . optimization_handles . lock ( ) . await ; let opt_handles = std :: mem :: take ( & mut * opt_handles_guard ) ; let stopping_handles = opt_handles . into_iter ( ) . map ( | h | h . stop ( ) ) . collect_vec ( ) ; for res in stopping_handles { res . await ? ; } Ok ( ( ) ) }
Gracefully wait before all optimizations stop
If some optimization is in progress - it will be finished before shutdown.
Gracefully wait before all optimizations stop If some optimization is in progress - it will be finished before shutdown .
&mut self
&mut self