mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-21 15:57:24 -06:00
Only update Cake stats infrequently because there tend to be a lot of them.
This commit is contained in:
parent
ba694719d4
commit
d0462870c1
@ -6,9 +6,11 @@ use self::min_max::{MinMaxAvgPair, MinMaxAvg};
|
||||
pub(crate) use session_buffer::{StatsSession, SESSION_BUFFER};
|
||||
use lqos_utils::unix_time::unix_now;
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use std::{collections::HashMap, net::IpAddr};
|
||||
use std::{collections::HashMap, net::IpAddr, sync::atomic::AtomicU64};
|
||||
use super::{HostSummary, NetworkTreeEntry};
|
||||
|
||||
static QUEUE_STATS_COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
pub(crate) async fn collate_stats(comm_tx: Sender<SenderChannelMessage>) {
|
||||
let timestamp = unix_now().unwrap_or(0);
|
||||
if timestamp == 0 {
|
||||
@ -116,7 +118,12 @@ pub(crate) async fn collate_stats(comm_tx: Sender<SenderChannelMessage>) {
|
||||
let (cpu, ram) = system_stats::get_cpu_ram().await;
|
||||
|
||||
// Obtain queue stats
|
||||
let cake_stats = super::update_cake_stats().await;
|
||||
let last_cake = QUEUE_STATS_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
let cake_stats = if last_cake % 10 == 0 {
|
||||
super::update_cake_stats().await
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
|
||||
// Add to the submissions queue
|
||||
|
Loading…
Reference in New Issue
Block a user