Skip to content

Commit fada7c4

Browse files
0o-de-lallyRaffa TempoLucietta MacUrchinCaty Cony
authored
[cli] ingest all queue fix (#20)
* fix ingest-all processing on gz, add test * patch order of queue check --------- Co-authored-by: Raffa Tempo <[email protected]> Co-authored-by: Lucietta MacUrchin <[email protected]> Co-authored-by: Caty Cony <[email protected]>
1 parent b42086f commit fada7c4

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/load.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,29 @@ pub async fn ingest_all(
4444

4545
// This manifest may be for a .gz file, we should handle here as well
4646
for (_p, m) in archive_map.0.iter() {
47-
info!("checking if we need to decompress");
48-
let (new_unzip_path, temp) = unzip_temp::maybe_handle_gz(&m.archive_dir)?;
49-
let mut better_man = ManifestInfo::new(&new_unzip_path);
50-
better_man.set_info()?;
51-
5247
println!(
5348
"\nProcessing: {:?} with archive: {}",
54-
better_man.contents,
55-
better_man.archive_dir.display()
49+
m.contents,
50+
m.archive_dir.display()
5651
);
5752

58-
let complete = queue::are_all_completed(pool, &better_man.archive_id).await?;
53+
let complete = queue::are_all_completed(pool, &m.archive_id).await?;
5954

6055
if !complete {
56+
info!("checking if we need to decompress");
57+
let (new_unzip_path, temp) = unzip_temp::maybe_handle_gz(&m.archive_dir)?;
58+
let mut better_man = ManifestInfo::new(&new_unzip_path);
59+
better_man.set_info()?;
60+
6161
let batch_tx_return = try_load_one_archive(&better_man, pool, batch_size).await?;
6262
println!("SUCCESS: {}", batch_tx_return);
63+
drop(temp);
6364
} else {
6465
info!(
6566
"archive complete (or not in queue): {}",
66-
better_man.archive_dir.display()
67+
m.archive_dir.display()
6768
);
6869
}
69-
drop(temp);
7070
}
7171

7272
Ok(())

src/unzip_temp.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ pub fn maybe_handle_gz(archive_path: &Path) -> Result<(PathBuf, Option<TempPath>
125125
// maybe stuff isn't unzipped yet
126126
let pattern = format!("{}/*.*.gz", archive_path.display());
127127
if glob(&pattern)?.count() > 0 {
128-
let mut temp_dir = TempPath::new();
128+
let temp_dir = TempPath::new();
129129
temp_dir.create_as_dir()?;
130-
temp_dir.persist();
131130

132131
// need to preserve the parent dir name in temp, since the manifest files reference it.
133132
let dir_name = archive_path.file_name().unwrap().to_str().unwrap();

0 commit comments

Comments
 (0)