Skip to content

Commit 75fc231

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
1 parent 8ab7639 commit 75fc231

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

crates/taurus/src/main.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use futures_lite::StreamExt;
1212
use log::error;
1313
use prost::Message;
1414
use std::collections::HashMap;
15-
use std::time::{SystemTime, UNIX_EPOCH};
15+
use std::time::{Instant, SystemTime, UNIX_EPOCH};
1616
use taurus_core::context::context::Context;
1717
use taurus_core::context::executor::Executor;
1818
use taurus_core::context::registry::FunctionStore;
@@ -25,7 +25,7 @@ use tucana::shared::{
2525
};
2626

2727
fn handle_message(flow: ExecutionFlow, store: &FunctionStore) -> (Signal, RuntimeUsage) {
28-
let now = SystemTime::now();
28+
let start = Instant::now();
2929
let mut context = Context::default();
3030

3131
let node_functions: HashMap<i64, NodeFunction> = flow
@@ -36,19 +36,13 @@ fn handle_message(flow: ExecutionFlow, store: &FunctionStore) -> (Signal, Runtim
3636

3737
let signal =
3838
Executor::new(store, node_functions).execute(flow.starting_node_id, &mut context, true);
39-
let timestamp = match now.duration_since(UNIX_EPOCH) {
40-
Ok(time) => time.as_millis(),
41-
Err(err) => {
42-
log::error!("cannot get current system time: {:?}", err);
43-
0
44-
}
45-
};
39+
let duration_millis = start.elapsed().as_millis() as i64;
4640

4741
(
4842
signal,
4943
RuntimeUsage {
5044
flow_id: flow.flow_id,
51-
duration: timestamp as i64,
45+
duration: duration_millis,
5246
},
5347
)
5448
}

0 commit comments

Comments
 (0)