More needless async removed.

This commit is contained in:
Herbert Wolverson
2024-09-05 09:52:08 -05:00
parent 8173833bd3
commit c33fcc0cff
5 changed files with 18 additions and 13 deletions

View File

@@ -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() {

View File

@@ -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(|| {

View File

@@ -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();

View File

@@ -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

View File

@@ -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<RwLock<NetworkJson>> =
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