diff --git a/src/rust/lqos_queue_tracker/src/queue_structure/queing_structure_json_monitor.rs b/src/rust/lqos_queue_tracker/src/queue_structure/queing_structure_json_monitor.rs index ba458d82..9fa8307a 100644 --- a/src/rust/lqos_queue_tracker/src/queue_structure/queing_structure_json_monitor.rs +++ b/src/rust/lqos_queue_tracker/src/queue_structure/queing_structure_json_monitor.rs @@ -39,9 +39,11 @@ impl QueueStructure { /// Global file watched for `queueStructure.json`. /// Reloads the queue structure when it is available. pub fn spawn_queue_structure_monitor() { + std::thread::spawn(|| { if let Err(e) = watch_for_queueing_structure_changing() { error!("Error watching for queueingStructure.json: {:?}", e); } + }); } fn update_queue_structure() { diff --git a/src/rust/lqosd/src/anonymous_usage/mod.rs b/src/rust/lqosd/src/anonymous_usage/mod.rs index 19331886..4ee23c3d 100644 --- a/src/rust/lqosd/src/anonymous_usage/mod.rs +++ b/src/rust/lqosd/src/anonymous_usage/mod.rs @@ -9,7 +9,7 @@ use crate::{shaped_devices_tracker::{SHAPED_DEVICES, NETWORK_JSON}, stats::HIGH_ const SLOW_START_SECS: u64 = 1; const INTERVAL_SECS: u64 = 60 * 60 * 24; -pub async fn start_anonymous_usage() { +pub fn start_anonymous_usage() { if let Ok(cfg) = lqos_config::load_config() { if cfg.usage_stats.send_anonymous { std::thread::spawn(|| { diff --git a/src/rust/lqosd/src/main.rs b/src/rust/lqosd/src/main.rs index 82368d80..bac85d00 100644 --- a/src/rust/lqosd/src/main.rs +++ b/src/rust/lqosd/src/main.rs @@ -94,9 +94,9 @@ async fn main() -> Result<()> { start_heimdall(); spawn_queue_structure_monitor(); shaped_devices_tracker::shaped_devices_watcher(); + shaped_devices_tracker::network_json_watcher(); + anonymous_usage::start_anonymous_usage(); join!( - shaped_devices_tracker::network_json_watcher(), - anonymous_usage::start_anonymous_usage(), throughput_tracker::spawn_throughput_monitor(long_term_stats_tx.clone(), flow_tx), ); spawn_queue_monitor(); diff --git a/src/rust/lqosd/src/shaped_devices_tracker/mod.rs b/src/rust/lqosd/src/shaped_devices_tracker/mod.rs index da711186..f1b74c41 100644 --- a/src/rust/lqosd/src/shaped_devices_tracker/mod.rs +++ b/src/rust/lqosd/src/shaped_devices_tracker/mod.rs @@ -27,10 +27,12 @@ fn load_shaped_devices() { } pub fn shaped_devices_watcher() { - info!("Watching for ShapedDevices.csv changes"); - if let Err(e) = watch_for_shaped_devices_changing() { - error!("Error watching for ShapedDevices.csv: {:?}", e); - } + std::thread::spawn(|| { + info!("Watching for ShapedDevices.csv changes"); + if let Err(e) = watch_for_shaped_devices_changing() { + error!("Error watching for ShapedDevices.csv: {:?}", e); + } + }); } /// Fires up a Linux file system watcher than notifies diff --git a/src/rust/lqosd/src/shaped_devices_tracker/netjson.rs b/src/rust/lqosd/src/shaped_devices_tracker/netjson.rs index 2c44dd1a..9ad709f3 100644 --- a/src/rust/lqosd/src/shaped_devices_tracker/netjson.rs +++ b/src/rust/lqosd/src/shaped_devices_tracker/netjson.rs @@ -4,16 +4,17 @@ use lqos_config::NetworkJson; use lqos_utils::file_watcher::FileWatcher; use once_cell::sync::Lazy; use std::sync::RwLock; -use tokio::task::spawn_blocking; pub static NETWORK_JSON: Lazy> = Lazy::new(|| RwLock::new(NetworkJson::default())); -pub async fn network_json_watcher() { - spawn_blocking(|| { - info!("Watching for network.kson changes"); - let _ = watch_for_network_json_changing(); - }); +pub fn network_json_watcher() { + std::thread::spawn(|| { + info!("Watching for network.kson changes"); + if let Err(e) = watch_for_network_json_changing() { + error!("Error watching for network.json changes: {:?}", e); + } + }); } /// Fires up a Linux file system watcher than notifies