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