Fallback for reminder days
This commit is contained in:
parent
1519474f93
commit
bb1c61d0b9
@ -345,7 +345,10 @@ WHERE
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn refresh(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
async fn refresh(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
||||||
if self.interval_seconds.is_some() || self.interval_months.is_some() {
|
if self.interval_seconds.is_some()
|
||||||
|
|| self.interval_months.is_some()
|
||||||
|
|| self.interval_days.is_some()
|
||||||
|
{
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
let mut updated_reminder_time =
|
let mut updated_reminder_time =
|
||||||
self.utc_time.with_timezone(&self.timezone.parse().unwrap_or(Tz::UTC));
|
self.utc_time.with_timezone(&self.timezone.parse().unwrap_or(Tz::UTC));
|
||||||
@ -365,9 +368,11 @@ WHERE
|
|||||||
updated_reminder_time = updated_reminder_time
|
updated_reminder_time = updated_reminder_time
|
||||||
.checked_add_days(Days::new(interval as u64))
|
.checked_add_days(Days::new(interval as u64))
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
warn!("Could not add days to a reminder");
|
warn!(
|
||||||
|
"Could not add days to a reminder. Falling back to naive addition"
|
||||||
|
);
|
||||||
|
|
||||||
updated_reminder_time
|
updated_reminder_time + 86400 * interval
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user