From 1158a6767613ba14ebb5359b118e025736ad8acd Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 17 Jan 2020 16:13:32 +0000 Subject: Improve the DNS cache expiration log message. Instead of constantly spamming the log file only show the message when an entry is actually expired and show how many entries were expired. --- src/coremods/core_dns.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 3412ec611..2e75a591f 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -682,16 +682,22 @@ class MyManager : public Manager, public Timer, public EventHandler bool Tick(time_t now) CXX11_OVERRIDE { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: purging DNS cache"); - + unsigned long expired = 0; for (cache_map::iterator it = this->cache.begin(); it != this->cache.end(); ) { const Query& query = it->second; if (IsExpired(query, now)) + { + expired++; this->cache.erase(it++); + } else ++it; } + + if (expired) + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: purged %lu expired DNS entries", expired); + return true; } -- cgit v1.2.3