Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/map/mc-p1' into map/mc-p3
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed Sep 11, 2023
2 parents e383f73 + 0a32b19 commit b232e6d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mobile_verifier/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use futures::{
stream::{BoxStream, Stream, StreamExt},
TryFutureExt, TryStreamExt,
};
use futures_util::stream;
use h3o::{CellIndex, LatLng};
use helium_crypto::PublicKeyBinary;
use helium_proto::services::{
Expand Down Expand Up @@ -340,14 +341,19 @@ impl CoveredHexStream for Pool<Postgres> {
.await?;

// Find the time of insertion for the currently in use coverage object
let current_inserted_at: DateTime<Utc> = sqlx::query_scalar(
let current_inserted_at: Option<DateTime<Utc>> = sqlx::query_scalar(
"SELECT inserted_at FROM hex_coverage WHERE cbsd_id = $1 AND uuid = $2 LIMIT 1",
)
.bind(cbsd_id)
.bind(coverage_obj)
.fetch_one(self)
.fetch_optional(self)
.await?;

// If we don't have an inserted_at, we don't have any hex coverage
let Some(current_inserted_at) = current_inserted_at else {
return Ok(stream::empty().boxed());
};

// Delete any hex coverages that were inserted before the one we are currently using, as they are
// no longer useful.
sqlx::query(
Expand Down

0 comments on commit b232e6d

Please sign in to comment.