Skip to content

Commit

Permalink
Delete heartbeats that have different hotspots for the given cbsd_id (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed Jun 28, 2023
1 parent 000140d commit 15cacfe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mobile_verifier/src/heartbeats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ impl Heartbeat {
if self.validity != proto::HeartbeatValidity::Valid {
return Ok(false);
}

sqlx::query("DELETE FROM heartbeats WHERE cbsd_id = $1 AND hotspot_key != $2")
.bind(&self.cbsd_id)
.bind(&self.hotspot_key)
.execute(&mut *exec)
.await?;

let truncated_timestamp = self.truncated_timestamp()?;
Ok(
sqlx::query_as::<_, HeartbeatSaveResult>(
Expand Down

0 comments on commit 15cacfe

Please sign in to comment.