Skip to content

Commit

Permalink
implement concurrent
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 27, 2024
1 parent bf5ca0c commit 6f9fc83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/json_rescue_v5_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub async fn decompress_and_extract(tgz_file: &Path, pool: &Graph) -> Result<u64
Ok(created_count)
}

const MAX_CONCURRENT_PARSE: usize = 50; // Number of concurrent parsing tasks
const MAX_CONCURRENT_PARSE: usize = 25; // Number of concurrent parsing tasks
const MAX_CONCURRENT_INSERT: usize = 1; // Number of concurrent database insert tasks

pub async fn concurrent_decompress_and_extract(tgz_file: &Path, pool: &Graph) -> Result<u64> {
Expand Down Expand Up @@ -102,7 +102,7 @@ pub async fn concurrent_decompress_and_extract(tgz_file: &Path, pool: &Graph) ->
}
}
}
Ok::<(), anyhow::Error>(())
Ok(())

Check failure on line 105 in src/json_rescue_v5_load.rs

View workflow job for this annotation

GitHub Actions / clippy

type annotations needed
})
});

Expand Down Expand Up @@ -202,7 +202,7 @@ pub async fn rip(start_dir: &Path, pool: &Graph) -> Result<u64> {
info!("tgz archives found: {}", tgz_list.len());
let mut txs = 0u64;
for p in tgz_list.iter() {
match decompress_and_extract(p, pool).await {
match concurrent_decompress_and_extract(p, pool).await {
Ok(t) => txs += t,
Err(e) => {
error!(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_json_rescue_v5_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn test_stream_load_all_tgz() -> anyhow::Result<()> {

let tx_count = json_rescue_v5_load::stream_decompress_and_extract(&path, &pool).await?;

assert!(tx_count == 5244);
assert!(tx_count == 6157);

Ok(())
}
Expand All @@ -90,7 +90,7 @@ async fn test_load_entrypoint() -> anyhow::Result<()> {
let path = fixtures::v5_json_tx_path();

let tx_count = json_rescue_v5_load::rip(&path, &pool).await?;
assert!(tx_count == 5244);
assert!(tx_count == 6157);

Ok(())
}
Expand Down

0 comments on commit 6f9fc83

Please sign in to comment.