Skip to content

Commit

Permalink
Add time elapsed to blocking api
Browse files Browse the repository at this point in the history
Erin van der Veen committed Feb 12, 2024

Verified

This commit was signed with the committer’s verified signature.
gortiz Gonzalo Ortiz Jaureguizar
1 parent ed4ec01 commit 50cbbed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion genealogos-api/src/main.rs
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@ fn analyze(
attribute_path: Option<&str>,
cyclonedx_version: Option<cyclonedx::Version>,
) -> Result<messages::AnalyzeResponse> {
let start_time = std::time::Instant::now();

// Construct the Source from the flake reference and attribute path
let source = genealogos::Source::Flake {
flake_ref: flake_ref.to_string(),
@@ -44,7 +46,10 @@ fn analyze(
})?;

let json = Json(messages::OkResponse {
metadata: messages::Metadata::new(None),
metadata: messages::Metadata {
time_taken: Some(start_time.elapsed()),
..Default::default()
},
data: messages::AnalyzeResponse { sbomb: sbom },
});

0 comments on commit 50cbbed

Please sign in to comment.