Skip to content

Commit

Permalink
Transport update + min ping interval tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiezzel committed Sep 29, 2023
1 parent 32686a8 commit c109803
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/network-scheduler/src/worker_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use router_controller::messages::{Ping, RangeSet};
use subsquid_network_transport::PeerId;

pub const WORKER_INACTIVE_TIMEOUT: Duration = Duration::from_secs(60);
pub const MIN_PING_INTERVAL: Duration = Duration::from_secs(8);
pub const SUPPORTED_WORKER_VERSIONS: [&str; 2] = ["0.1.2", "0.1.3"];

fn worker_version_supported(ver: &str) -> bool {
Expand Down Expand Up @@ -86,7 +87,7 @@ impl WorkerRegistry {
};

if let Some(prev_state) = self.known_workers.get(&worker_id) {
if Instant::now().duration_since(prev_state.last_ping) < Duration::from_secs(10) {
if Instant::now().duration_since(prev_state.last_ping) < MIN_PING_INTERVAL {
log::warn!("Worker {worker_id} sending pings too often");
return false;
}
Expand Down

0 comments on commit c109803

Please sign in to comment.