Fix min/max.

main
Tom Alexander 2 weeks ago
parent 32ce3d989b
commit 3a1c25bb19
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -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);

Loading…
Cancel
Save