mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Only recycle domains when their last query was more than 24 hours ago.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -53,6 +53,10 @@ bool doGC = false;
|
||||
// by any query (only head and tail of the CNAME chain are)
|
||||
static void recycle(void)
|
||||
{
|
||||
// Get current time
|
||||
const double twentyfour_hrs_ago = double_time() - 24*3600;
|
||||
|
||||
// Allocate memory for recycling
|
||||
bool *client_used = calloc(counters->clients, sizeof(bool));
|
||||
bool *domain_used = calloc(counters->domains, sizeof(bool));
|
||||
bool *cache_used = calloc(counters->dns_cache_size, sizeof(bool));
|
||||
@@ -122,6 +126,13 @@ static void recycle(void)
|
||||
if(domain == NULL)
|
||||
continue;
|
||||
|
||||
// Only recycle domains when their last query was more than 24
|
||||
// hours ago. This ensures that we do not recycle domains that
|
||||
// have recently been seen but which are not part of any query
|
||||
// (e.g., intermediate domains during CNAME inspection)
|
||||
if(domain->lastQuery > twentyfour_hrs_ago)
|
||||
continue;
|
||||
|
||||
log_debug(DEBUG_GC, "Recycling domain %s (ID %u, lastQuery at %.3f)",
|
||||
getstr(domain->domainpos), domainID, domain->lastQuery);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user