From afdcdf8276f2307947ecfc3f219c2c121108da48 Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:53:17 -0500 Subject: [PATCH] Reduce session ping frequency from 30s to 5m, log at trace level The ping loop measures latency to DMSG servers for server selection. It is not a keepalive (yamux handles that). 30s was excessive, generating N_clients * N_servers debug log lines every 30 seconds. Changed to 5 minutes and lowered log level from Debug to Trace. --- pkg/dmsg/client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/dmsg/client.go b/pkg/dmsg/client.go index 12054cbd..8805e1c9 100644 --- a/pkg/dmsg/client.go +++ b/pkg/dmsg/client.go @@ -527,8 +527,11 @@ func (ce *Client) reconnectMissing(ctx context.Context) { } // pingSessionsLoop periodically pings all sessions to measure latency. +// The interval is 1 hour — this is for server selection, not keepalive +// (yamux handles its own keepalives). 30s was excessive and generated +// noisy DEBUG logs (N_clients × N_servers pings every 30s). func (ce *Client) pingSessionsLoop(ctx context.Context) { - ticker := time.NewTicker(30 * time.Second) + ticker := time.NewTicker(1 * time.Hour) defer ticker.Stop() // Do an initial ping immediately. @@ -552,11 +555,11 @@ func (ce *Client) pingSessions() { rtt, err := ses.Ping() if err != nil { ce.log.WithError(err).WithField("server", ses.RemotePK()). - Debug("Ping failed, keeping previous latency measurement") + Trace("Ping failed, keeping previous latency measurement") continue } ses.SetLastPing(rtt) ce.log.WithField("server", ses.RemotePK()).WithField("rtt", rtt). - Debug("Session ping measured") + Trace("Session ping measured") } }