@@ -12,7 +12,7 @@ use futures_lite::StreamExt;
1212use log:: error;
1313use prost:: Message ;
1414use std:: collections:: HashMap ;
15- use std:: time:: { SystemTime , UNIX_EPOCH } ;
15+ use std:: time:: { Instant , SystemTime , UNIX_EPOCH } ;
1616use taurus_core:: context:: context:: Context ;
1717use taurus_core:: context:: executor:: Executor ;
1818use taurus_core:: context:: registry:: FunctionStore ;
@@ -25,7 +25,7 @@ use tucana::shared::{
2525} ;
2626
2727fn 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