fix: remove invalid offline -> online check
This commit is contained in:
parent
3991d25293
commit
50468db20b
1 changed files with 1 additions and 6 deletions
|
|
@ -208,7 +208,6 @@ pub fn apply_state(
|
|||
|
||||
let outcome = match current.state {
|
||||
CachedState::Unknown => ApplyStateOutcome::Applied,
|
||||
CachedState::Offline { since } if timestamp < since => ApplyStateOutcome::Stale,
|
||||
CachedState::Offline { .. } => ApplyStateOutcome::Applied,
|
||||
CachedState::Live { status: _, since } if timestamp < since => ApplyStateOutcome::Stale,
|
||||
CachedState::Live { status: current_status, since }
|
||||
|
|
@ -409,16 +408,12 @@ mod tests {
|
|||
mark_offline(&conn, 3000).unwrap();
|
||||
assert_eq!(
|
||||
apply_state(&conn, DoorStatus::Open, 2500, 3100).unwrap(),
|
||||
ApplyStateOutcome::Stale
|
||||
);
|
||||
assert_eq!(
|
||||
apply_state(&conn, DoorStatus::Open, 3200, 3201).unwrap(),
|
||||
ApplyStateOutcome::Applied
|
||||
);
|
||||
|
||||
let status = get_status(&conn).unwrap();
|
||||
assert_eq!(status.status, DoorStatus::Open);
|
||||
assert_eq!(status.since, Some(3200));
|
||||
assert_eq!(status.since, Some(2500));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue