From 71ec784e2237a10ff2d98f306affc5b1e719d223 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sun, 8 Feb 2026 10:28:51 +0100 Subject: [PATCH] Make pingout_duration configurable In irctest I use faketime in some tests to make time pass 15 times faster for Sable so it does not have to actually wait a long time for some expiries to occur. Along with Github CI's flakiness, this means that nodes sometimes exceed this timeout and kill each other, so I need it to be higher. --- configs/network_config.json | 1 + sable_network/src/network/config/mod.rs | 3 +++ sable_network/src/node/pings.rs | 4 +--- sable_network/tests/utils/mod.rs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configs/network_config.json b/configs/network_config.json index 365556c0..303ca33f 100644 --- a/configs/network_config.json +++ b/configs/network_config.json @@ -1,5 +1,6 @@ { "object_expiry": 300, + "pingout_duration": 240, "opers": [ { diff --git a/sable_network/src/network/config/mod.rs b/sable_network/src/network/config/mod.rs index 9b7253f9..1b621599 100644 --- a/sable_network/src/network/config/mod.rs +++ b/sable_network/src/network/config/mod.rs @@ -16,6 +16,8 @@ pub struct NetworkConfig { pub alias_users: Vec, pub object_expiry: i64, + /// How long from sending a server ping before we force it to quit from the network + pub pingout_duration: i64, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -42,6 +44,7 @@ impl NetworkConfig { default_roles: HashMap::new(), alias_users: Vec::new(), object_expiry: 0, + pingout_duration: 240, } } } diff --git a/sable_network/src/node/pings.rs b/sable_network/src/node/pings.rs index 813e692b..c611fa28 100644 --- a/sable_network/src/node/pings.rs +++ b/sable_network/src/node/pings.rs @@ -2,8 +2,6 @@ use wrapper::ObjectWrapper as _; use super::*; -const PINGOUT_DURATION: i64 = 240; - impl NetworkNode { pub(super) fn check_pings(&self) { let now = utils::now(); @@ -13,7 +11,7 @@ impl NetworkNode { for server in self.net.read().servers() { let last_ping = server.last_ping(); - if now - last_ping > PINGOUT_DURATION { + if now - last_ping > self.net.read().config().pingout_duration { let data = server.raw(); tracing::info!(?last_ping, ?now, ?data, "Pinging out server"); diff --git a/sable_network/tests/utils/mod.rs b/sable_network/tests/utils/mod.rs index 2a781d18..69c5fda2 100644 --- a/sable_network/tests/utils/mod.rs +++ b/sable_network/tests/utils/mod.rs @@ -11,6 +11,7 @@ pub fn empty_network_config() -> NetworkConfig { default_roles: HashMap::new(), alias_users: Vec::new(), object_expiry: 0, + pingout_duration: 240, } }