Very low interval times on the cake watcher were causing issues. The underlying data updates at the specified speed (with a server-side ringbuffer), so delay the update speed to maintain reasonable server load.

This commit is contained in:
Herbert Wolverson 2024-07-19 09:34:47 -05:00
parent 27b84e2425
commit 4ecf968acc

View File

@ -1,16 +1,11 @@
use lqos_bus::QueueStoreTransit;
use lqos_config::load_config;
use lqos_queue_tracker::{add_watched_queue, get_raw_circuit_data, still_watching};
pub(super) async fn cake_watcher(circuit_id: String, tx: tokio::sync::mpsc::Sender<String>) {
let interval_ms = if let Ok(config) = load_config() {
config.queue_check_period_ms
} else {
0
};
const INTERVAL_MS: u64 = 1000;
add_watched_queue(&circuit_id);
let mut ticker = tokio::time::interval(tokio::time::Duration::from_millis(interval_ms));
let mut ticker = tokio::time::interval(tokio::time::Duration::from_millis(INTERVAL_MS));
ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
loop {
ticker.tick().await;