From 3999c99af71e9f275c34cc668b7231b851f9e4b6 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 11 May 2023 09:00:45 +1000 Subject: [PATCH] Fix a panic when user sets a huge learning step --- rslib/src/scheduler/states/steps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/scheduler/states/steps.rs b/rslib/src/scheduler/states/steps.rs index 61b669bac..00f9cb4cc 100644 --- a/rslib/src/scheduler/states/steps.rs +++ b/rslib/src/scheduler/states/steps.rs @@ -66,7 +66,7 @@ impl<'a> LearningSteps<'a> { // 50% more than the again secs, but at most one day more // otherwise, a learning step of 3 days and a graduating interval of 4 days e.g. // would lead to the hard interval being larger than the good interval - let secs = (again_secs.saturating_mul(3) / 2).min(again_secs + DAY); + let secs = (again_secs.saturating_mul(3) / 2).min(again_secs.saturating_add(DAY)); maybe_round_in_days(secs) } }