Skip to content

Commit

Permalink
invoke graph analysis ingestion only when we ingest sbom
Browse files Browse the repository at this point in the history
  • Loading branch information
JimFuller-RedHat committed Sep 11, 2024
1 parent 885ff29 commit bd335e1
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions modules/ingestor/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,26 @@ impl IngestorService {
.load(&self.graph, labels.into(), issuer, &result.digests, stream)
.await?;

// TODO: there maybe better ways to do this
let analysis_service = AnalysisService::new(self.graph.db.clone());
match analysis_service
.load_graphs(vec![result.id.value()], ())
.await
{
Ok(_) => log::debug!(
"Analysis graph for sbom: {} loaded successfully.",
result.id.value()
),
Err(e) => log::warn!(
"Error loading sbom {} into analysis graph : {}",
result.id.value(),
e
),
}
match fmt {
Format::SPDX | Format::CycloneDX => {
let analysis_service = AnalysisService::new(self.graph.db.clone());
match analysis_service
.load_graphs(vec![result.id.value()], ())
.await
{
Ok(_) => log::debug!(
"Analysis graph for sbom: {} loaded successfully.",
result.id.value()
),
Err(e) => log::warn!(
"Error loading sbom {} into analysis graph : {}",
result.id.value(),
e
),
}
}
_ => {}
};

let duration = Instant::now() - start;
log::debug!(
Expand Down

0 comments on commit bd335e1

Please sign in to comment.