Skip to content

Commit 917075b

Browse files
committed
fix(rad): retrievals running time computation
1 parent 54e2459 commit 917075b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

rad/src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ async fn http_response(
267267
})?
268268
};
269269

270+
// Start timer for measuring resolution time
271+
let start_ts = std::time::SystemTime::now();
272+
270273
// Use the provided HTTP client, or instantiate a new one if none
271274
let client = match client {
272275
Some(client) => client,
@@ -373,7 +376,20 @@ async fn http_response(
373376
message: x.to_string(),
374377
})?;
375378

376-
let result = run_retrieval_with_data_report(retrieve, &response_string, context, settings);
379+
let result = run_retrieval_with_data_report(retrieve, &response_string, context, settings)
380+
// override running_time within the final report including
381+
.map(|report| {
382+
let completion_ts = std::time::SystemTime::now();
383+
RadonReport {
384+
context: ReportContext {
385+
start_time: Some(start_ts),
386+
completion_time: Some(completion_ts),
387+
..report.context
388+
},
389+
running_time: completion_ts.duration_since(start_ts).unwrap_or_default(),
390+
..report
391+
}
392+
});
377393

378394
match &result {
379395
Ok(report) => {

0 commit comments

Comments
 (0)