Skip to content

Commit

Permalink
minor clean up. done with everything for real this time.
Browse files Browse the repository at this point in the history
there could be possible improvements by not using join_all, due to the
issue mentioned in rust-lang/futures-rs#2387.
However, I doubt there is much speedup to be extracted, since most of
the bottleneck are the requests.
  • Loading branch information
zawedcvg committed Jul 8, 2024
1 parent 8687d1c commit 0c8a2f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions ranked/parser/src/inserting_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub async fn inserting_info(game: Game) -> Result<(), Box<dyn std::error::Error>
let match_id = match_id_future.await;

let bulk_search_players = bulk_search_future.await;
println!("done searching at {:?}", now.elapsed());

for (&player, query_output) in game.get_player_vec().iter().zip(bulk_search_players) {
let db_player_id: i32;
Expand Down Expand Up @@ -77,16 +76,13 @@ pub async fn inserting_info(game: Game) -> Result<(), Box<dyn std::error::Error>
}
}

println!("done sending stuff for inserts at {:?}", now.elapsed());

let mut insert_new_commander: Vec<_> = Vec::new();

let mut win_list: Vec<_> = Vec::new();

let returned_elos = join_all(commander_details_futures).await;

println!("{:?} done waiting for elos ", now.elapsed());

let mut elo_list = Vec::new();
for ((db_player_id, _, player), returned_elo) in zip!(commander_bulk_insert, returned_elos) {
match returned_elo {
Expand Down Expand Up @@ -116,14 +112,11 @@ pub async fn inserting_info(game: Game) -> Result<(), Box<dyn std::error::Error>
bulk_insert_into_matches_players_commander(&commander_bulk_insert, pool.clone());

update_commander_elo(&new_elos, &commander_bulk_insert, &win_list, pool.clone()).await;
println!("{:?} updating the elos", now.elapsed());

bulk_fps_insert_future.await;
bulk_commander_insert_future.await;
join_all(insert_new_commander).await;

println!("{:?} at the end", now.elapsed());

Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion ranked/parser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ use crate::parser::checking_folder;

fn main() {
let game = checking_folder("/home/neeladri/Silica/ranked/log_folder/".to_string());
inserting_info(game);
let _ = inserting_info(game);
}

0 comments on commit 0c8a2f4

Please sign in to comment.