File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -757,10 +757,14 @@ fn duration_in_inner<'a>(
757
757
let state = state. materialize ( agg. states_as_str ( ) ) ;
758
758
let mut total = 0 ;
759
759
for tis in agg. combined_durations . iter ( ) {
760
- if tis. state . materialize ( agg. states_as_str ( ) ) == state {
761
- let tis_start_time = i64:: max ( tis. start_time , start) ;
762
- let tis_end_time = i64:: min ( tis. end_time , end) ;
763
- if tis_end_time >= start && tis_start_time <= end {
760
+ let tis_start_time = i64:: max ( tis. start_time , start) ;
761
+ let tis_end_time = i64:: min ( tis. end_time , end) ;
762
+ if tis_start_time > end {
763
+ // combined_durations is sorted, so after this point there can't be any more
764
+ break ;
765
+ } ;
766
+ if tis_end_time >= start {
767
+ if tis. state . materialize ( agg. states_as_str ( ) ) == state {
764
768
let amount = tis_end_time - tis_start_time;
765
769
assert ! ( amount >= 0 , "incorrectly ordered times" ) ;
766
770
total += amount;
You can’t perform that action at this time.
0 commit comments