diff --git a/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/asn.rs b/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/asn.rs index 014f5a8e..152b08ee 100644 --- a/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/asn.rs +++ b/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/asn.rs @@ -62,7 +62,7 @@ impl GeoTable { } fn download() -> anyhow::Result<()> { - debug!("Downloading ASN-IP Table"); + tracing::warn!("Downloading ASN-IP Table"); let file_path = Self::file_path(); let url = "https://stats.libreqos.io/geo2.bin"; let response = reqwest::blocking::get(url)?; diff --git a/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/mod.rs b/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/mod.rs index be4c2e66..9c0be091 100644 --- a/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/mod.rs +++ b/src/rust/lqosd/src/throughput_tracker/flow_data/flow_analysis/mod.rs @@ -26,19 +26,16 @@ pub struct FlowAnalysisSystem { impl FlowAnalysisSystem { pub fn new() -> Self { - // Periodically update the ASN table + // Moved from being periodically updated to being updated on startup let _ = std::thread::Builder::new().name("GeoTable Updater".to_string()).spawn(|| { - loop { - let result = asn::GeoTable::load(); - match result { - Ok(table) => { - ANALYSIS.asn_table.lock().unwrap().replace(table); - } - Err(e) => { - error!("Failed to update ASN table: {e}"); - } + let result = asn::GeoTable::load(); + match result { + Ok(table) => { + ANALYSIS.asn_table.lock().unwrap().replace(table); + } + Err(e) => { + error!("Failed to update ASN table: {e}"); } - std::thread::sleep(std::time::Duration::from_secs(60 * 60 * 24)); } }); @@ -61,6 +58,8 @@ impl FlowAnalysisSystem { } pub fn setup_flow_analysis() -> anyhow::Result<()> { + // This is locking the table, which triggers lazy-loading of the + // data. It's not actually doing nothing. let e = ANALYSIS.asn_table.lock(); if e.is_err() { anyhow::bail!("Failed to lock ASN table");