Skip to content

Commit 303d009

Browse files
committed
refactor: swap to unwrap_or to utilize duration
1 parent 88e123e commit 303d009

File tree

1 file changed

+2
-1
lines changed
  • src/append/rolling_file/policy/compound/trigger

1 file changed

+2
-1
lines changed

src/append/rolling_file/policy/compound/trigger/time.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ impl TimeTrigger {
204204
#[cfg(not(test))]
205205
let current = Local::now();
206206
// In the case where bad user input results in an invalid next time, provide a valid time.
207-
let next_time = TimeTrigger::get_next_time(current, config.interval, config.modulate).unwrap_or(i64::MAX);
207+
let next_time = TimeTrigger::get_next_time(current, config.interval, config.modulate)
208+
.unwrap_or(current + Duration::try_seconds(1_i64).unwrap());
208209
let next_roll_time = if config.max_random_delay > 0 {
209210
let random_delay = rand::thread_rng().gen_range(0..config.max_random_delay);
210211
// This is a valid unwrap because chrono::Duration::try_milliseconds accepts an i64

0 commit comments

Comments
 (0)