⏰ backup: an attempt stamped in the future counts as due
Browse files at this commitd4353ee5a1553edbe763e4da8aaea59e66b68239Parent: fdb2a7b1 changed file +3 -1
crates/in-web/src/backup.rsmodified+3 -1
| @@ -144,7 +144,9 @@ async fn record_outcome(store: &Store, outcome: &in_core::error::Result<std::pat | ||
| 144 | 144 | /// have a fixed width, so comparing them as text compares their times. |
| 145 | 145 | pub fn is_due(last_attempt: Option<&str>, interval_hours: u32) -> bool { |
| 146 | 146 | let interval = Duration::from_secs(u64::from(interval_hours) * 60 * 60); |
| 147 | - last_attempt.is_none_or(|stamp| stamp < stamp_before(interval).as_str()) | |
| 147 | + // An attempt stamped in the future means the clock went back: run rather than wait for it. | |
| 148 | + let now = now_stamp(); | |
| 149 | + last_attempt.is_none_or(|stamp| stamp < stamp_before(interval).as_str() || stamp > now.as_str()) | |
| 148 | 150 | } |
| 149 | 151 | |
| 150 | 152 | /// True when there is no successful backup within the limit: [`STALE_AFTER`] or two backup intervals, |