refactor: this is fun
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/clippy Pipeline was successful Details
ci/woodpecker/push/build Pipeline was successful Details

main
Jef Roosens 2023-07-08 13:53:18 +02:00
parent 1acfc9c422
commit 32d923e64b
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 5 additions and 7 deletions

View File

@ -153,13 +153,11 @@ where
/// Calculate the next time a backup should be created. If no backup has been created yet, it
/// will return now.
pub fn next_scheduled_time(&self) -> chrono::DateTime<Utc> {
if let Some(last_chain) = self.chains.last() {
if let Some(last_backup) = last_chain.last() {
return last_backup.start_time + self.frequency;
}
}
chrono::offset::Utc::now()
self.chains
.last()
.and_then(|last_chain| last_chain.last())
.map(|last_backup| last_backup.start_time + self.frequency)
.unwrap_or_else(chrono::offset::Utc::now)
}
/// Search for a chain containing a backup with the specified start time.