Skip to content

Commit

Permalink
Avoid panic when time jumps backwards.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelovuo committed Jan 2, 2025
1 parent 59a72e4 commit ad5e03e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/structure/dds_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ impl TopicCache {
start_instant: Timestamp,
end_instant: Timestamp,
) -> Box<dyn Iterator<Item = (Timestamp, &CacheChange)> + '_> {
// Sanity check
let start_instant =
if start_instant <= end_instant {
// sane case
start_instant
} else {
// insane case
error!("get_changes_in_range_best_effort: Did my clock jump backwards? start={start_instant:?} end={end_instant:?}");
end_instant
};

// Get result as tree range
Box::new(
self
.changes
Expand Down

0 comments on commit ad5e03e

Please sign in to comment.