node: Change ping interval to 1 minute

30 seconds is too chatty.
This commit is contained in:
Alexis Sellier 2023-03-23 12:11:17 +01:00 committed by Alexis Sellier
parent 8dba01d6ae
commit 4438a10498
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -62,9 +62,9 @@ pub const SYNC_INTERVAL: LocalDuration = LocalDuration::from_secs(60);
/// How often to run the "prune" task. /// How often to run the "prune" task.
pub const PRUNE_INTERVAL: LocalDuration = LocalDuration::from_mins(30); pub const PRUNE_INTERVAL: LocalDuration = LocalDuration::from_mins(30);
/// Duration to wait on an unresponsive peer before dropping its connection. /// Duration to wait on an unresponsive peer before dropping its connection.
pub const STALE_CONNECTION_TIMEOUT: LocalDuration = LocalDuration::from_secs(60); pub const STALE_CONNECTION_TIMEOUT: LocalDuration = LocalDuration::from_mins(1);
/// How much time should pass after a peer was last active for a *ping* to be sent. /// How much time should pass after a peer was last active for a *ping* to be sent.
pub const KEEP_ALIVE_DELTA: LocalDuration = LocalDuration::from_secs(30); pub const KEEP_ALIVE_DELTA: LocalDuration = LocalDuration::from_mins(1);
/// Maximum time difference between the local time, and an announcement timestamp. /// Maximum time difference between the local time, and an announcement timestamp.
pub const MAX_TIME_DELTA: LocalDuration = LocalDuration::from_mins(60); pub const MAX_TIME_DELTA: LocalDuration = LocalDuration::from_mins(60);
/// Maximum attempts to connect to a peer before we give up. /// Maximum attempts to connect to a peer before we give up.
@ -1397,7 +1397,7 @@ where
let stale = self let stale = self
.sessions .sessions
.connected() .connected()
.filter(|(_, session)| session.last_active < *now - STALE_CONNECTION_TIMEOUT); .filter(|(_, session)| *now - session.last_active >= STALE_CONNECTION_TIMEOUT);
for (_, session) in stale { for (_, session) in stale {
self.reactor.disconnect( self.reactor.disconnect(