Skip to content

Commit

Permalink
feat(rad): include retrieval response time within WitnetResultReports
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Feb 23, 2024
1 parent bb93e1e commit 155c669
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion rad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ async fn http_response(
})
})?;

let start_ts = std::time::SystemTime::now();
let response = client
.send(request)
.await
Expand All @@ -306,7 +307,19 @@ async fn http_response(
message: x.to_string(),
})?;

let result = run_retrieval_with_data_report(retrieve, &response_string, context, settings);
let result = run_retrieval_with_data_report(retrieve, &response_string, context, settings)
.map(|report| {
let completion_ts = std::time::SystemTime::now();
RadonReport {
context: ReportContext {
start_time: Some(start_ts),
completion_time: Some(completion_ts),
..report.context
},
running_time: completion_ts.duration_since(start_ts).unwrap_or_default(),
..report
}
});

match &result {
Ok(report) => {
Expand Down

0 comments on commit 155c669

Please sign in to comment.