Skip to content

Commit

Permalink
Avoid another panic on system time jumping backwards.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelovuo committed Jan 10, 2025
1 parent 5564767 commit b3af08e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/structure/dds_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ impl TopicCache {
// Now, reallocate old cache changes
let reallocate_timeout = crate::Duration::from_secs(5);
let now = Timestamp::now();
let reallocate_limit = now - reallocate_timeout;

// Take max to avoid crash if clock jumps backward.
let reallocate_limit = max(now - reallocate_timeout, self.changes_reallocated_up_to);

self
.changes
Expand Down

0 comments on commit b3af08e

Please sign in to comment.