The purpose of the following function is to execute an async helper function multiple times and collect the results in a single vector. Yet, the function never completes.
pub async fn bootstrap_n(graph: Graph, sector: String) -> Vec<(String, String, f64)> {
let n = 2;
let result = Arc::new(Mutex::new(Vec::<(String, String, f64)>::new()));
let mut handles = Vec::with_capacity(n);
for _ in 0..n {
let graph = graph.clone();
let sector = sector.clone();
let result_arc = result.clone();
handles.push(tokio::spawn(async move {
let ret = bootstrap(graph, sector).await;
let mut copy = result_arc.lock().await;
copy.extend(ret);
}));
}
let _ = futures::future::join_all(handles).await;
let inner: Vec<_> = Arc::try_unwrap(result).unwrap().into_inner();
inner
}