From 5af47d20aeadceb149abe4e99d910944b32400fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:11:52 +0200 Subject: [PATCH] Erase dead channels --- nano/lib/stats_enums.hpp | 1 + nano/node/telemetry.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nano/lib/stats_enums.hpp b/nano/lib/stats_enums.hpp index 9b27ee8ad8..f91318e17a 100644 --- a/nano/lib/stats_enums.hpp +++ b/nano/lib/stats_enums.hpp @@ -365,6 +365,7 @@ enum class detail failed_send_telemetry_req, empty_payload, cleanup_outdated, + erase_stale, // vote generator generator_broadcasts, diff --git a/nano/node/telemetry.cpp b/nano/node/telemetry.cpp index dc3077e508..c197ee86bf 100644 --- a/nano/node/telemetry.cpp +++ b/nano/node/telemetry.cpp @@ -244,10 +244,14 @@ void nano::telemetry::cleanup () // Remove if telemetry data is stale if (!check_timeout (entry)) { - stats.inc (nano::stat::type::telemetry, nano::stat::detail::cleanup_outdated); + stats.inc (nano::stat::type::telemetry, nano::stat::detail::erase_stale); + return true; // Erase + } + if (!entry.channel->alive ()) + { + stats.inc (nano::stat::type::telemetry, nano::stat::detail::erase_dead); return true; // Erase } - return false; // Do not erase }); }