Skip to content

Commit

Permalink
Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
kurotych committed Dec 9, 2024
1 parent 78c519f commit 2898d4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mobile_config/src/gateway_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pub(crate) mod db {
pub async fn get_updated_radios(
db: impl PgExecutor<'_>,
min_updated_at: DateTime<Utc>,
) -> anyhow::Result<HashSet<String>> {
) -> anyhow::Result<HashSet<PublicKeyBinary>> {
let rows: Vec<Vec<u8>> = sqlx::query_scalar(GET_UPDATED_RADIOS)
.bind(min_updated_at)
.fetch_all(db)
Expand All @@ -392,7 +392,8 @@ pub(crate) mod db {
for row in rows {
let entity_key_b: &[u8] = &row;
let entity_key = bs58::encode(entity_key_b).into_string();
radios.insert(entity_key);
let pk = PublicKeyBinary::from_str(&entity_key)?;
radios.insert(pk);
}

Ok(radios)
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/gateway_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl mobile_config::Gateway for GatewayService {

let updated_redios = get_updated_radios(&mc_pool, min_updated_at).await?;
let stream = stream
.filter(|v| future::ready(updated_redios.contains(&v.address.to_string())))
.filter(|v| future::ready(updated_redios.contains(&v.address)))
.boxed();
stream_multi_gateways_info(stream, tx.clone(), signing_key.clone(), batch_size)
.await
Expand Down

0 comments on commit 2898d4b

Please sign in to comment.