Skip to content

Commit f668d80

Browse files
committed
fix: changes to time handler
1 parent 59db71d commit f668d80

4 files changed

Lines changed: 8 additions & 44 deletions

File tree

crates/taurus-core/src/runtime/engine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ mod tests {
414414
_ctx: &mut ValueStore,
415415
_run: &mut ThunkRunner<'_>,
416416
) -> Signal {
417-
std::thread::sleep(Duration::from_millis(2));
417+
std::thread::sleep(Duration::from_micros(2_000));
418418
Signal::Success(null_value())
419419
}
420420

crates/taurus-core/src/runtime/execution/value_store.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use tucana::shared::{
99
};
1010

1111
use crate::runtime::execution::trace::{StoreInputSlotEntry, StoreResultEntry, StoreSnapshot};
12-
use crate::time::now_unix_micros;
1312
use crate::types::errors::runtime_error::RuntimeError;
1413

1514
#[derive(Clone)]
@@ -147,20 +146,6 @@ impl ValueStore {
147146
self.flow_input = value;
148147
}
149148

150-
pub fn insert_success(&mut self, id: i64, value: Value) {
151-
self.insert_success_with_parameters(id, value, Vec::new());
152-
}
153-
154-
pub fn insert_success_with_parameters(
155-
&mut self,
156-
id: i64,
157-
value: Value,
158-
parameter_results: Vec<NodeParameterNodeExecutionResult>,
159-
) {
160-
let ts = now_unix_micros();
161-
self.insert_success_with_timing(id, value, parameter_results, ts, ts);
162-
}
163-
164149
pub fn insert_success_with_timing(
165150
&mut self,
166151
id: i64,
@@ -181,20 +166,6 @@ impl ValueStore {
181166
);
182167
}
183168

184-
pub fn insert_error(&mut self, id: i64, runtime_error: RuntimeError) {
185-
self.insert_error_with_parameters(id, runtime_error, Vec::new());
186-
}
187-
188-
pub fn insert_error_with_parameters(
189-
&mut self,
190-
id: i64,
191-
runtime_error: RuntimeError,
192-
parameter_results: Vec<NodeParameterNodeExecutionResult>,
193-
) {
194-
let ts = now_unix_micros();
195-
self.insert_error_with_timing(id, runtime_error, parameter_results, ts, ts);
196-
}
197-
198169
pub fn insert_error_with_timing(
199170
&mut self,
200171
id: i64,

crates/taurus-core/src/time.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@ pub fn now_unix_micros() -> i64 {
88
.map(|it| it.as_micros() as i64)
99
.unwrap_or(0)
1010
}
11-
12-
pub fn now_unix_ms() -> i64 {
13-
SystemTime::now()
14-
.duration_since(UNIX_EPOCH)
15-
.map(|it| it.as_millis() as i64)
16-
.unwrap_or(0)
17-
}

crates/taurus-core/src/types/errors/runtime_error.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tucana::shared::{
1515
Error as TucanaError, NumberValue as ProtoNumberValue, Struct, Value, number_value,
1616
};
1717

18-
use crate::time::now_unix_ms;
18+
use crate::time::now_unix_micros;
1919

2020
/// Runtime execution failure representation.
2121
#[derive(Debug, Clone, PartialEq)]
@@ -26,8 +26,8 @@ pub struct RuntimeError {
2626
pub category: String,
2727
/// Human-readable diagnostic message.
2828
pub message: String,
29-
/// Unix timestamp in milliseconds when this error object was created.
30-
pub timestamp_unix_ms: u64,
29+
/// Unix timestamp in microseconds when this error object was created.
30+
pub timestamp_unix_micros: u64,
3131
/// Runtime version identifier.
3232
pub version: String,
3333
/// Dependency versions relevant to this runtime.
@@ -47,7 +47,7 @@ impl RuntimeError {
4747
code: code.into(),
4848
category: category.into(),
4949
message: message.into(),
50-
timestamp_unix_ms: now_unix_ms() as u64,
50+
timestamp_unix_micros: now_unix_micros() as u64,
5151
version: env!("CARGO_PKG_VERSION").to_string(),
5252
dependencies: HashMap::new(),
5353
details: HashMap::new(),
@@ -112,7 +112,7 @@ impl RuntimeError {
112112
Value {
113113
kind: Some(NumberValue(ProtoNumberValue {
114114
number: Some(number_value::Number::Integer(
115-
self.timestamp_unix_ms as i64,
115+
self.timestamp_unix_micros as i64,
116116
)),
117117
})),
118118
},
@@ -150,7 +150,7 @@ impl RuntimeError {
150150
code: self.code.clone(),
151151
category: self.category.clone(),
152152
message: self.message.clone(),
153-
timestamp: self.timestamp_unix_ms as i64,
153+
timestamp: self.timestamp_unix_micros as i64,
154154
version: self.version.clone(),
155155
dependencies: self.dependencies.clone(),
156156
details: Some(Struct {
@@ -165,7 +165,7 @@ impl RuntimeError {
165165
code: error.code.clone(),
166166
category: error.category.clone(),
167167
message: error.message.clone(),
168-
timestamp_unix_ms: error.timestamp.max(0) as u64,
168+
timestamp_unix_micros: error.timestamp.max(0) as u64,
169169
version: error.version.clone(),
170170
dependencies: error.dependencies.clone(),
171171
details: error

0 commit comments

Comments
 (0)