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

daemon: prioritize load checks over idle state in system state determination

This commit is contained in:
NotAShelf 2025-05-17 06:20:26 +03:00
parent f0932c64d9
commit c046c27376
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -618,16 +618,18 @@ fn determine_system_state(report: &SystemReport, history: &SystemHistory) -> Sys
} }
} }
// Check idle state // Check load first, as high load should take precedence over idle state
if history.is_system_idle() {
return SystemState::Idle;
}
// Check load
let avg_load = report.system_load.load_avg_1min; let avg_load = report.system_load.load_avg_1min;
if avg_load > 3.0 { if avg_load > 3.0 {
return SystemState::HighLoad; return SystemState::HighLoad;
} }
// Check idle state only if we don't have high load
if history.is_system_idle() {
return SystemState::Idle;
}
// Check for low load
if avg_load < 0.5 { if avg_load < 0.5 {
return SystemState::LowLoad; return SystemState::LowLoad;
} }