Skip to content

Commit

Permalink
Delete old hex coverages
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed Jul 24, 2023
1 parent 1deea42 commit 9c88a27
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mobile_verifier/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,18 @@ impl CoveredHexStream for Pool<Postgres> {
.execute(self)
.await?;

// Is this a valid delete?
sqlx::query("DELETE FROM hex_coverage WHERE cbsd_id = $1 AND uuid != $2 AND coverage_claim_time < $3")
.bind(cbsd_id)
.bind(coverage_obj)
.bind(seniority.seniority_ts)
.execute(self)
.await?;

Ok(
sqlx::query_as("SELECT * FROM hex_coverage WHERE cbsd_id = $1 AND uuid = $2")
.bind(cbsd_id)
.bind(*coverage_obj)
.bind(coverage_obj)
.fetch(self)
.map_ok(move |hc| HexCoverage {
coverage_claim_time: seniority.seniority_ts,
Expand Down

0 comments on commit 9c88a27

Please sign in to comment.