Skip to content

Commit

Permalink
Fix bug where we update seniority for non valid heartbeats
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed Jul 31, 2023
1 parent 20e656e commit d95f40d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mobile_verifier/src/heartbeats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl HeartbeatDaemon {
));

while let Some(heartbeat) = validated_heartbeats.next().await.transpose()? {
if heartbeat.coverage_object.is_some() {
if heartbeat.is_valid() && heartbeat.coverage_object.is_some() {
let coverage_claim_time = coverage_claim_time_cache
.fetch_coverage_claim_time(
&heartbeat.cbsd_id,
Expand Down Expand Up @@ -219,6 +219,10 @@ pub struct Heartbeat {
}

impl Heartbeat {
fn is_valid(&self) -> bool {
self.validity == proto::HeartbeatValidity::Valid
}

pub fn truncated_timestamp(&self) -> Result<DateTime<Utc>, RoundingError> {
self.timestamp.duration_trunc(Duration::hours(1))
}
Expand Down

0 comments on commit d95f40d

Please sign in to comment.