From 257d133a071738b1beaecc4cf945ef6f2cdb2c79 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 30 Jul 2021 12:58:58 +0300 Subject: [PATCH] reduce log spam from empty heartbeat messages --- gossipsub.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gossipsub.go b/gossipsub.go index 31816797..28bb6c33 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -1296,7 +1296,12 @@ func (gs *GossipSubRouter) heartbeatTimer() { } func (gs *GossipSubRouter) heartbeat() { - defer log.Infow("heartbeat") + start := time.Now() + defer func() { + if dt := time.Since(start); dt > time.Millisecond { + log.Infow("heartbeat done", "took", dt) + } + }() gs.heartbeatTicks++