Parallelize individual table reads/writes for modest gains.

This commit is contained in:
Nolan Darilek 2025-06-16 15:46:46 -04:00
parent 8f10dff3a0
commit 75144e21ee

View file

@ -34,10 +34,20 @@ async fn test_mysql() -> Result<(), Error> {
let pool = TestPool::try_new().await?;
crate::load_data(&pool).await?;
time_test::time_test!();
crate::convert_data(&pool, "employees").await?;
crate::convert_data(&pool, "departments").await?;
<mysql_async::Pool as Clone>::clone(&pool)
.disconnect()
.await?;
let tables = vec!["employees", "departments"];
let mut handles: Vec<tokio::task::JoinHandle<Result<(), crate::Error>>> = vec![];
for table in tables {
handles.push(tokio::spawn({
let pool = pool.clone();
let table = table.to_string();
async move {
crate::convert_data(&pool, &table).await?;
Ok(())
}
}));
}
for handle in handles {
let _ = handle.await?;
}
Ok(())
}