Skip to content

Commit

Permalink
info print
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 20, 2024
1 parent ea17497 commit 2f9e1ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/queue.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::{bail, Context, Result};
use log::info;
use neo4rs::Graph;

use crate::scan::ArchiveMap;
Expand Down Expand Up @@ -65,8 +66,7 @@ pub async fn is_batch_complete(
let cypher_string = format!(
r#"
MATCH (a:Queue {{ archive_id: "{}", batch: {} }})
WHERE a.completed = false
RETURN COUNT(a) = 0 AS is_complete;
RETURN DISTINCT a.completed;
"#,
archive_id, batch
);
Expand All @@ -80,7 +80,7 @@ pub async fn is_batch_complete(

if let Some(row) = res.next().await? {
// Extract `archive_id` as a String
Ok(row.get::<bool>("is_complete").ok())
Ok(row.get::<bool>("a.completed").ok())
} else {
bail!("not found")
}
Expand All @@ -107,6 +107,7 @@ pub async fn push_queue_from_archive_map(map: &ArchiveMap, pool: &Graph) -> Resu
for (_, a) in map.0.iter() {
// set at least one batch of each archive_id to false, so it gets picked up in the queue
update_task(pool, &a.archive_id, false, 0).await?;
info!("enqueued archive {}, batch #0", &a.archive_id);
}
Ok(())
}

0 comments on commit 2f9e1ce

Please sign in to comment.