Skip to content

Commit

Permalink
Update hermes/src/aggregate/metrics.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Reisen <[email protected]>
  • Loading branch information
ali-bahjati and Reisen authored Oct 18, 2023
1 parent 0dd441e commit 8260478
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions hermes/src/aggregate/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,12 @@ impl Metrics {

/// Observe a slot and event. An event at a slot should be observed only once.
pub fn observe(&mut self, slot: Slot, event: Event) {
let order = if let Some(newest_observed_slot) = self.newest_observed_slot.get(&event) {
if slot > *newest_observed_slot {
self.newest_observed_slot.insert(event.clone(), slot);
SlotOrder::New
} else {
SlotOrder::OutOfOrder
}
} else {
let order = if self.newest_observed_slot.get(&event)
.map_or(true, |&observed_slot| slot > observed_slot) {
self.newest_observed_slot.insert(event.clone(), slot);
SlotOrder::New
} else {
SlotOrder::OutOfOrder
};


Expand Down

0 comments on commit 8260478

Please sign in to comment.