Fix min/max.

This commit is contained in:
Tom Alexander 2024-05-05 12:08:38 -04:00
parent 32ce3d989b
commit 3a1c25bb19
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -44,9 +44,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
let time_until_next_action = db_conn.get_time_until_next_action()?;
let sleep_duration = std::cmp::min(
let sleep_duration = std::cmp::max(
time::Duration::from_secs(60),
std::cmp::max(time_until_next_action, time::Duration::from_secs(300)),
std::cmp::min(time_until_next_action, time::Duration::from_secs(300)),
);
println!("Sleeping for {} seconds.", sleep_duration.as_secs());
thread::sleep(sleep_duration);