From dec251b3ec9eb25cdba19f0c0f984b8fa8b127f0 Mon Sep 17 00:00:00 2001 From: Raymond Sukanto Date: Wed, 9 Oct 2024 12:42:12 -0400 Subject: [PATCH 1/2] remvoe minimum peer error in health check --- network/network.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/network/network.go b/network/network.go index eab4ecca085e..9f0524e1bd48 100644 --- a/network/network.go +++ b/network/network.go @@ -410,9 +410,6 @@ func (n *network) HealthCheck(context.Context) (interface{}, error) { } var errorReasons []string - if !isConnected { - errorReasons = append(errorReasons, fmt.Sprintf("not connected to a minimum of %d peer(s) only %d", n.config.HealthConfig.MinConnectedPeers, connectedTo)) - } if !msgReceived { errorReasons = append(errorReasons, "no messages received from network") } else if !wasMsgReceivedRecently { From f2a91455f2b1f60c04045555ae58bb124a94e255 Mon Sep 17 00:00:00 2001 From: Raymond Sukanto Date: Thu, 10 Oct 2024 11:24:35 -0400 Subject: [PATCH 2/2] Remove health check err msg --- network/network.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/network/network.go b/network/network.go index 9f0524e1bd48..defced950203 100644 --- a/network/network.go +++ b/network/network.go @@ -10,7 +10,6 @@ import ( "math" "net" "net/netip" - "strings" "sync" "sync/atomic" "time" @@ -409,22 +408,10 @@ func (n *network) HealthCheck(context.Context) (interface{}, error) { return details, nil } - var errorReasons []string - if !msgReceived { - errorReasons = append(errorReasons, "no messages received from network") - } else if !wasMsgReceivedRecently { - errorReasons = append(errorReasons, fmt.Sprintf("no messages from network received in %s > %s", timeSinceLastMsgReceived, n.config.HealthConfig.MaxTimeSinceMsgReceived)) - } - if !msgSent { - errorReasons = append(errorReasons, "no messages sent to network") - } else if !wasMsgSentRecently { - errorReasons = append(errorReasons, fmt.Sprintf("no messages from network sent in %s > %s", timeSinceLastMsgSent, n.config.HealthConfig.MaxTimeSinceMsgSent)) - } - if !isMsgFailRate { - errorReasons = append(errorReasons, fmt.Sprintf("messages failure send rate %g > %g", sendFailRate, n.config.HealthConfig.MaxSendFailRate)) + return details, fmt.Errorf("messages failure send rate %g > %g", sendFailRate, n.config.HealthConfig.MaxSendFailRate) } - return details, fmt.Errorf("network layer is unhealthy reason: %s", strings.Join(errorReasons, ", ")) + return details, nil } // Connected is called after the peer finishes the handshake.