From 303d0099661986609999a6cb55e006ed303a9bd0 Mon Sep 17 00:00:00 2001 From: bconn98 Date: Tue, 9 Jul 2024 21:19:10 -0400 Subject: [PATCH] refactor: swap to unwrap_or to utilize duration --- src/append/rolling_file/policy/compound/trigger/time.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/append/rolling_file/policy/compound/trigger/time.rs b/src/append/rolling_file/policy/compound/trigger/time.rs index efef2242..4405abbb 100644 --- a/src/append/rolling_file/policy/compound/trigger/time.rs +++ b/src/append/rolling_file/policy/compound/trigger/time.rs @@ -204,7 +204,8 @@ impl TimeTrigger { #[cfg(not(test))] let current = Local::now(); // In the case where bad user input results in an invalid next time, provide a valid time. - let next_time = TimeTrigger::get_next_time(current, config.interval, config.modulate).unwrap_or(i64::MAX); + let next_time = TimeTrigger::get_next_time(current, config.interval, config.modulate) + .unwrap_or(current + Duration::try_seconds(1_i64).unwrap()); let next_roll_time = if config.max_random_delay > 0 { let random_delay = rand::thread_rng().gen_range(0..config.max_random_delay); // This is a valid unwrap because chrono::Duration::try_milliseconds accepts an i64