Skip to content

Commit

Permalink
use offset to determine tx scaler recent activity (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck authored Apr 18, 2023
1 parent 444573f commit e881a35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion iot_verifier/src/tx_scaler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub struct Server {
hex_density_map: SharedHexDensityMap,
pool: PgPool,
trigger_interval: Duration,
refresh_offset: Duration,
}

#[derive(Debug, thiserror::Error)]
Expand All @@ -46,6 +47,7 @@ impl Server {
hex_density_map: SharedHexDensityMap::new(),
pool,
trigger_interval: Duration::seconds(settings.transmit_scale_interval),
refresh_offset: settings.loader_window_max_lookback_age(),
};

server.refresh_scaling_map().await?;
Expand Down Expand Up @@ -80,7 +82,7 @@ impl Server {
}

pub async fn refresh_scaling_map(&mut self) -> Result<(), TxScalerError> {
let refresh_start = Utc::now();
let refresh_start = Utc::now() - self.refresh_offset;
tracing::info!("density_scaler: generating hex scaling map, starting at {refresh_start:?}");
let mut global_map = GlobalHexMap::new();
let active_gateways = self
Expand Down

0 comments on commit e881a35

Please sign in to comment.