Fix min/max.
This commit is contained in:
parent
32ce3d989b
commit
3a1c25bb19
@ -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 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),
|
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());
|
println!("Sleeping for {} seconds.", sleep_duration.as_secs());
|
||||||
thread::sleep(sleep_duration);
|
thread::sleep(sleep_duration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user