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