1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

daemon: enforce user-configured min and max polling interval limits

This commit is contained in:
NotAShelf 2025-05-17 02:08:21 +03:00
parent 264cd6a4e9
commit 7047f64984
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -411,6 +411,12 @@ pub fn run_daemon(mut config: AppConfig, verbose: bool) -> Result<(), Box<dyn st
- ((current_poll_interval - optimal_interval) / 2).max(1);
}
// Make sure that we respect the (user) configured min and max limits
current_poll_interval = current_poll_interval.clamp(
config.daemon.min_poll_interval_sec,
config.daemon.max_poll_interval_sec,
);
debug!("Adaptive polling: set interval to {current_poll_interval}s");
} else {
// If adaptive polling is disabled, still apply battery-saving adjustment