From 7294297bd4e4093866d2627b1f428900b27fdf87 Mon Sep 17 00:00:00 2001 From: ales stibal Date: Mon, 13 May 2024 12:08:23 +0200 Subject: [PATCH] max size removal and some more logging --- src/proxy/nbrhood.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/proxy/nbrhood.hpp b/src/proxy/nbrhood.hpp index fd81c1e..76a2a0e 100644 --- a/src/proxy/nbrhood.hpp +++ b/src/proxy/nbrhood.hpp @@ -51,7 +51,7 @@ struct Neighbor { static inline logan_lite log = logan_lite("proxy.nbr"); - static constexpr size_t max_timetable_sz = 14; + static inline size_t max_timetable_sz = 30; explicit Neighbor(std::string_view hostname): hostname(hostname) { last_seen = time(nullptr); @@ -149,17 +149,21 @@ struct Neighbor { auto this_de = epoch_days(last_seen); if(timetable.empty()) { + _dia("neighbor update: %s: new timetable entry", hostname.c_str()); timetable.emplace_back(); } else { auto cur_de = timetable[0].days_epoch; if(cur_de == this_de) { + _dia("neighbor update: %s: update today timetable", hostname.c_str()); timetable[0].update(); } else { + _dia("neighbor update: %s: add today timetable", hostname.c_str()); auto nev = stats_entry_t(); timetable.insert(timetable.begin(), nev); - if (timetable.size() > max_timetable_sz) { + while (timetable.size() > max_timetable_sz) { + _dia("neighbor update: %s: removing excess timetable entry", hostname.c_str()); timetable.pop_back(); } }