Skip to content

Instantly share code, notes, and snippets.

@Enigo
Created January 11, 2023 04:03
Show Gist options
  • Save Enigo/f255d40094e09f9bf3ac838cc50f71f7 to your computer and use it in GitHub Desktop.
Save Enigo/f255d40094e09f9bf3ac838cc50f71f7 to your computer and use it in GitHub Desktop.
pub async fn read_orders() {
let response = fetch_api_response::<Order>(ORDERS_URL).await;
match response {
Ok(order) => {
info!("Processing order response");
let mut futures = vec![];
for result in order.result {
let future = task::spawn(process_order(result));
futures.push(future);
}
join_all(futures).await;
}
Err(e) => { ... }
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment