From 5223b1e1f26b1666d3f65d73fe85ec341d327603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rytis=20Karpu=C5=A1ka?= Date: Thu, 30 Nov 2023 18:41:36 +0200 Subject: [PATCH] Flush libmoose changes upon sending heartbeat event libtelio heartbeat event is generally a once an hour occurance, therefore it is expected that event throughput is so low, that the moose queue will never contain more than one element. What is more, in tests there is an expectation that after triggering the analytics, database will contain events relatively soon. For some reason this does not happen in about 10% of the cases. This change is an attempt to verify whether flushing has impact on the event queueing. --- crates/telio-lana/src/event_log_file.rs | 5 +++++ crates/telio-nurse/src/nurse.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/crates/telio-lana/src/event_log_file.rs b/crates/telio-lana/src/event_log_file.rs index e1a47f1a1..711d52247 100644 --- a/crates/telio-lana/src/event_log_file.rs +++ b/crates/telio-lana/src/event_log_file.rs @@ -461,6 +461,11 @@ pub mod moose { } } + /// Mocked moose function + pub fn flush_changes() -> std::result::Result { + Ok(Result::Success) + } + /// Mocked moose function. pub fn fetch_specific_context(name: &str) -> std::result::Result { match super::event_log("fetch_specific_context", Some(vec![name])) { diff --git a/crates/telio-nurse/src/nurse.rs b/crates/telio-nurse/src/nurse.rs index 2295061e6..a3794f993 100644 --- a/crates/telio-nurse/src/nurse.rs +++ b/crates/telio-nurse/src/nurse.rs @@ -251,6 +251,8 @@ impl State { qos_data.rtt_loss, qos_data.tx ); + + let _ = lana!(flush_changes); } fn meshnet_id() -> Uuid {