From 2898d4b90c7f5482ada82a0faf8786d46f4dccef Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Mon, 9 Dec 2024 17:20:10 +0200 Subject: [PATCH] Optimization --- mobile_config/src/gateway_info.rs | 5 +++-- mobile_config/src/gateway_service.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mobile_config/src/gateway_info.rs b/mobile_config/src/gateway_info.rs index 430ea49b8..0a758fae7 100644 --- a/mobile_config/src/gateway_info.rs +++ b/mobile_config/src/gateway_info.rs @@ -382,7 +382,7 @@ pub(crate) mod db { pub async fn get_updated_radios( db: impl PgExecutor<'_>, min_updated_at: DateTime, - ) -> anyhow::Result> { + ) -> anyhow::Result> { let rows: Vec> = sqlx::query_scalar(GET_UPDATED_RADIOS) .bind(min_updated_at) .fetch_all(db) @@ -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) diff --git a/mobile_config/src/gateway_service.rs b/mobile_config/src/gateway_service.rs index a5329265a..97d73a7a8 100644 --- a/mobile_config/src/gateway_service.rs +++ b/mobile_config/src/gateway_service.rs @@ -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