Skip to content

Commit

Permalink
Chore: Add some info and debug level messages to indicate that the qu…
Browse files Browse the repository at this point in the history
…eue monitors are still alive/making changes.
  • Loading branch information
thebracket committed Jan 11, 2025
1 parent 1d2a0f3 commit 106fe2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rust/lqos_queue_tracker/src/tracking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
circuit_to_queue::CIRCUIT_TO_QUEUE, interval::QUEUE_MONITOR_INTERVAL,
queue_store::QueueStore, tracking::reader::read_named_queue_from_interface,
};
use tracing::{debug, warn};
use tracing::{debug, info, warn};
use lqos_utils::fdtimer::periodic;
mod reader;
mod watched_queues;
Expand Down Expand Up @@ -237,13 +237,15 @@ pub fn spawn_queue_monitor() -> anyhow::Result<()> {
track_queues();
unlock_tc();
did_something = true;
debug!("Queue reader completed.");
}

// Wait for the timer to expire
let missed_ticks = tfd.read();
if missed_ticks > 0 && did_something {
// If we missed a tick, adjust the interval
interval_ms = (missed_ticks + 1) * QUEUE_MONITOR_INTERVAL.load(std::sync::atomic::Ordering::Relaxed);
info!("Queue monitor interval adjusted to {interval_ms} ms.");
tfd.set_state(TimerState::Periodic{
current: Duration::new(interval_ms / 1000, 0),
interval: Duration::new(interval_ms / 1000, 0)}, SetTimeFlags::Default
Expand All @@ -269,6 +271,7 @@ pub fn spawn_queue_monitor() -> anyhow::Result<()> {
if lock_tc() {
all_queue_reader();
unlock_tc();
debug!("All queue reader completed.");
did_something = true;
}

Expand All @@ -277,6 +280,7 @@ pub fn spawn_queue_monitor() -> anyhow::Result<()> {
if missed_ticks > 0 && did_something {
// If we missed a tick, adjust the interval
interval_ms = (missed_ticks + 2) * 2000;
info!("All queue monitor interval adjusted to {interval_ms} ms.");
tfd.set_state(TimerState::Periodic{
current: Duration::new(interval_ms / 1000, 0),
interval: Duration::new(interval_ms / 1000, 0)}, SetTimeFlags::Default
Expand Down

0 comments on commit 106fe2a

Please sign in to comment.