Skip to content

Commit

Permalink
Have mobile-config track when the data for a mobile-radio changes (#902)
Browse files Browse the repository at this point in the history
* Track when data for mobile radio changes
  • Loading branch information
bbalser authored Dec 4, 2024
1 parent cfa9afb commit 44b26c5
Show file tree
Hide file tree
Showing 7 changed files with 365 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion mobile_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license.workspace = true
anyhow = { workspace = true }
async-trait = { workspace = true }
base64 = { workspace = true }
blake3 = { workspace = true }
bs58 = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
Expand All @@ -20,6 +21,8 @@ futures = { workspace = true }
futures-util = { workspace = true }
helium-crypto = { workspace = true, features = ["sqlx-postgres"] }
helium-proto = { workspace = true }
humantime = { workspace = true }
humantime-serde = { workspace = true }
hextree = { workspace = true }
http = { workspace = true }
http-serde = { workspace = true }
Expand All @@ -44,7 +47,6 @@ triggered = { workspace = true }
task-manager = { path = "../task_manager" }
solana-sdk = { workspace = true }
custom-tracing = { path = "../custom_tracing", features = ["grpc"] }
humantime-serde = { workspace = true }
coverage-map = { path = "../coverage_map" }

[dev-dependencies]
Expand Down
7 changes: 7 additions & 0 deletions mobile_config/migrations/7_mobile_radio_tracker.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS mobile_radio_tracker (
entity_key BYTEA NOT NULL,
hash TEXT NOT NULL,
last_changed_at TIMESTAMPTZ NOT NULL,
last_checked_at TIMESTAMPTZ NOT NULL,
PRIMARY KEY (entity_key)
);
1 change: 1 addition & 0 deletions mobile_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod gateway_service;
pub mod hex_boosting_service;

pub mod key_cache;
pub mod mobile_radio_tracker;
pub mod settings;
pub mod telemetry;

Expand Down
7 changes: 6 additions & 1 deletion mobile_config/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use mobile_config::{
admin_service::AdminService, authorization_service::AuthorizationService,
carrier_service::CarrierService, entity_service::EntityService,
gateway_service::GatewayService, hex_boosting_service::HexBoostingService, key_cache::KeyCache,
settings::Settings,
mobile_radio_tracker::MobileRadioTracker, settings::Settings,
};
use std::{net::SocketAddr, path::PathBuf, time::Duration};
use task_manager::{ManagedTask, TaskManager};
Expand Down Expand Up @@ -108,6 +108,11 @@ impl Daemon {

TaskManager::builder()
.add_task(grpc_server)
.add_task(MobileRadioTracker::new(
pool.clone(),
metadata_pool.clone(),
settings.mobile_radio_tracker_interval,
))
.build()
.start()
.await
Expand Down
Loading

0 comments on commit 44b26c5

Please sign in to comment.