pub async fn wait_single(&mut self) {
        let (result, completed_index, _) = future::select_all(&mut self.task_handles).await;
        // Remove the completed task so that it doesn't panic when polling tasks in `Self::complete()`.
        self.task_handles.swap_remove(completed_index);

        match result {
            Ok(Ok(())) => {
                if self.tasks_allowed_to_finish {
                    tracing::info!("One of the actors finished its run. Finishing execution.");
                } else {
                    let err =
                        "One of the actors finished its run, while it wasn't expected to do it";
                    tracing::error!("{err}");
                    zksync_vlog::sentry::capture_message(
                        err,
                        zksync_vlog::sentry::AlertLevel::Warning,
                    );
                }
            }
            Ok(Err(err)) => {
                let err =
                    format!("One of the tokio actors unexpectedly finished with error: {err:#}");
                tracing::error!("{err}");
                zksync_vlog::sentry::capture_message(
                    &err,
                    zksync_vlog::sentry::AlertLevel::Warning,
                );
            }
            Err(error) => {
                let panic_message = try_extract_panic_message(error);
                tracing::info!("One of the tokio actors panicked: {panic_message}");
            }
        }
    }
Waits until a single managed task terminates, no matter the outcome.
core/lib/task_management/src/lib.rs