mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-27 06:33:20 -05:00
fix request of death in /api/signals
This commit is contained in:
parent
146a27aac7
commit
4ffb922805
@ -246,7 +246,10 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Then include changes up to (but not including) the end time.
|
// Then include changes up to (but not including) the end time.
|
||||||
for (&when, p) in self.points_by_time.range(desired_time.clone()) {
|
// BTreeMap has a strange behavior in which it will panic if end < start, even though
|
||||||
|
// std::ops::Range says "it is empty if start >= end". Make the behavior sane by hand.
|
||||||
|
let t = desired_time.start..std::cmp::max(desired_time.end, desired_time.start);
|
||||||
|
for (&when, p) in self.points_by_time.range(t) {
|
||||||
let mut it = p.changes();
|
let mut it = p.changes();
|
||||||
while let Some((signal, state)) = it.next().expect("in-mem changes is valid") {
|
while let Some((signal, state)) = it.next().expect("in-mem changes is valid") {
|
||||||
f(&ListStateChangesRow {
|
f(&ListStateChangesRow {
|
||||||
@ -965,6 +968,10 @@ mod tests {
|
|||||||
recording::Time::min_value()..recording::Time::max_value(),
|
recording::Time::min_value()..recording::Time::max_value(),
|
||||||
&mut |r| rows.push(*r),
|
&mut |r| rows.push(*r),
|
||||||
);
|
);
|
||||||
|
s.list_changes_by_time(
|
||||||
|
recording::Time::max_value()..recording::Time::min_value(),
|
||||||
|
&mut |_r| panic!("no changes expected"),
|
||||||
|
);
|
||||||
assert_eq!(&rows[..], EXPECTED);
|
assert_eq!(&rows[..], EXPECTED);
|
||||||
let mut expected_days = days::Map::new();
|
let mut expected_days = days::Map::new();
|
||||||
expected_days.0.insert(
|
expected_days.0.insert(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user