|
1 | 1 | use std::collections::HashMap; |
2 | 2 | use std::sync::Arc; |
3 | | -use std::sync::atomic::AtomicBool; |
4 | 3 | use std::sync::Mutex as StdMutex; |
| 4 | +use std::sync::atomic::AtomicBool; |
| 5 | +use std::time::{SystemTime, UNIX_EPOCH}; |
5 | 6 |
|
6 | 7 | use super::*; |
7 | 8 | use depot_client_types::{HEAD_FENCE_MISMATCH_CODE, HEAD_FENCE_MISMATCH_GROUP}; |
@@ -34,6 +35,13 @@ struct SqliteOperationLog { |
34 | 35 | error_message: Option<String>, |
35 | 36 | } |
36 | 37 |
|
| 38 | +fn now_timestamp_ms() -> i64 { |
| 39 | + let duration = SystemTime::now() |
| 40 | + .duration_since(UNIX_EPOCH) |
| 41 | + .unwrap_or_default(); |
| 42 | + i64::try_from(duration.as_millis()).unwrap_or(i64::MAX) |
| 43 | +} |
| 44 | + |
37 | 45 | #[derive(Clone)] |
38 | 46 | struct SqliteOperationLogLayer { |
39 | 47 | records: Arc<StdMutex<Vec<SqliteOperationLog>>>, |
@@ -173,6 +181,7 @@ fn test_envoy_handle() -> (EnvoyHandle, mpsc::UnboundedReceiver<ToEnvoyMessage>) |
173 | 181 | ws_tx: Arc::new(AsyncMutex::new(None::<mpsc::UnboundedSender<WsTxMessage>>)), |
174 | 182 | protocol_metadata: Arc::new(AsyncMutex::new(None)), |
175 | 183 | shutting_down: AtomicBool::new(false), |
| 184 | + last_ping_ts: std::sync::atomic::AtomicI64::new(now_timestamp_ms()), |
176 | 185 | stopped_tx: tokio::sync::watch::channel(true).0, |
177 | 186 | }); |
178 | 187 |
|
@@ -318,7 +327,10 @@ async fn remote_execute_logs_operation_context_at_source() { |
318 | 327 | let result = db |
319 | 328 | .execute( |
320 | 329 | "SELECT ?", |
321 | | - Some(vec![BindParam::Integer(1), BindParam::Text("two".to_owned())]), |
| 330 | + Some(vec![ |
| 331 | + BindParam::Integer(1), |
| 332 | + BindParam::Text("two".to_owned()), |
| 333 | + ]), |
322 | 334 | ) |
323 | 335 | .await; |
324 | 336 |
|
|
0 commit comments