diff --git a/crates/re_query/src/cache_stats.rs b/crates/re_query/src/cache_stats.rs index 19494f5a8de5a..2277213cecb11 100644 --- a/crates/re_query/src/cache_stats.rs +++ b/crates/re_query/src/cache_stats.rs @@ -83,7 +83,7 @@ impl Caches { ( key.clone(), ( - cache.time_range(), + cache.pending_time_range(), CachedComponentStats { total_indices: cache.indices.len() as _, total_instances: cache.num_instances(), diff --git a/crates/re_query/src/range/query.rs b/crates/re_query/src/range/query.rs index 4a3b05ff992dc..2eb0aec40d484 100644 --- a/crates/re_query/src/range/query.rs +++ b/crates/re_query/src/range/query.rs @@ -63,7 +63,7 @@ impl Caches { // and coarsly invalidates the whole cache in that case, to avoid the kind of bugs // showcased in . { - let time_range = cache.per_data_time.read_recursive().time_range(); + let time_range = cache.per_data_time.read_recursive().pending_time_range(); if let Some(time_range) = time_range { { let hole_start = time_range.max(); @@ -373,7 +373,7 @@ impl RangeComponentResultsInner { }); let pending_min = i64::min(pending_front_min, pending_back_min); - if let Some(time_range) = self.time_range() { + if let Some(time_range) = self.pending_time_range() { let time_range_min = i64::min(time_range.min().as_i64().saturating_sub(1), pending_min); reduced_query .range @@ -454,7 +454,7 @@ impl RangeComponentResultsInner { }); let pending_max = i64::max(pending_back_max, pending_front_max); - if let Some(time_range) = self.time_range() { + if let Some(time_range) = self.pending_time_range() { let time_range_max = i64::max(time_range.max().as_i64().saturating_add(1), pending_max); reduced_query .range diff --git a/crates/re_query/src/range/results.rs b/crates/re_query/src/range/results.rs index 069dacd0b005e..13526c513f3ed 100644 --- a/crates/re_query/src/range/results.rs +++ b/crates/re_query/src/range/results.rs @@ -776,14 +776,22 @@ impl RangeComponentResultsInner { } } - /// Returns the time range covered by the cached data. + /// Returns the pending time range that will be covered by the cached data. /// /// Reminder: [`TimeInt::STATIC`] is never included in [`ResolvedTimeRange`]s. #[inline] - pub fn time_range(&self) -> Option { - let first_time = self.indices.front().map(|(t, _)| *t)?; - let last_time = self.indices.back().map(|(t, _)| *t)?; - Some(ResolvedTimeRange::new(first_time, last_time)) + pub fn pending_time_range(&self) -> Option { + let pending_front_min = self.promises_front.first().map(|((t, _), _)| *t); + let pending_front_back = self.promises_front.first().map(|((t, _), _)| *t); + let pending_back_max = self.promises_back.last().map(|((t, _), _)| *t); + + let first_time = self.indices.front().map(|(t, _)| *t); + let last_time = self.indices.back().map(|(t, _)| *t); + + Some(ResolvedTimeRange::new( + pending_front_min.or(first_time)?, + pending_back_max.or(last_time).or(pending_front_back)?, + )) } #[inline] @@ -801,7 +809,7 @@ impl RangeComponentResultsInner { pub fn truncate_at_time(&mut self, threshold: TimeInt) { re_tracing::profile_function!(); - let time_range = self.time_range(); + let time_range = self.pending_time_range(); let Self { indices,