Avoid overflow of interval

This commit is contained in:
Erèbe - Romain Gerard 2023-11-22 14:57:59 +01:00 committed by GitHub
parent 9e0fd6b11a
commit 30b160fe53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ pub(super) async fn propagate_read(
// We do our own pin_mut! to avoid shadowing timeout and be able to reset it, on next loop iteration
// We reuse the future to avoid creating a timer in the tight loop
let frequency = ping_frequency.unwrap_or(Duration::from_secs(u64::MAX));
let frequency = ping_frequency.unwrap_or(Duration::from_secs(3600 * 24));
let start_at = Instant::now().checked_add(frequency).unwrap_or(Instant::now());
let timeout = tokio::time::interval_at(start_at, frequency);
pin_mut!(timeout);