From d57b7ccb53e917e37d11a03796251c6de4a3956f Mon Sep 17 00:00:00 2001 From: immanuwell Date: Sat, 30 May 2026 21:55:46 +0400 Subject: [PATCH] fix: remove duplicate wrong error log in socket/fetch handler and dead code in reliablePing --- common.go | 14 +++----------- main.go | 4 ---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/common.go b/common.go index 8fd89f1..6b8ab80 100644 --- a/common.go +++ b/common.go @@ -121,19 +121,11 @@ func reliablePing(tnet *netstack.Net, dst string, baseTimeout time.Duration, max totalLatency += latency successCount++ - // If we get at least one success, we can return early for health checks - if successCount > 0 { - avgLatency := totalLatency / time.Duration(successCount) - // logger.Debug("Reliable ping succeeded after %d attempts, avg latency: %v", attempt, avgLatency) - return avgLatency, nil - } - } - - if successCount == 0 { - return 0, fmt.Errorf("all %d ping attempts failed, last error: %v", maxAttempts, lastErr) + // Return on first success + return totalLatency / time.Duration(successCount), nil } - return totalLatency / time.Duration(successCount), nil + return 0, fmt.Errorf("all %d ping attempts failed, last error: %v", maxAttempts, lastErr) } func pingWithRetry(tnet *netstack.Net, dst string, timeout time.Duration) (stopChan chan struct{}, err error) { diff --git a/main.go b/main.go index 448f71d..2a5bdbf 100644 --- a/main.go +++ b/main.go @@ -1482,10 +1482,6 @@ persistent_keepalive_interval=5`, util.FixKey(privateKey.String()), util.FixKey( err = client.SendMessage("newt/socket/containers", map[string]interface{}{ "containers": containers, }) - if err != nil { - logger.Error("Failed to send registration message: %v", err) - } - if err != nil { logger.Error("Failed to send Docker container list: %v", err) } else {