From 8c5090d89f71e98e770ef0ebbad5ccff69fa80de Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Mon, 13 Dec 2021 21:12:27 +0300 Subject: [PATCH] Pull request: querylog: opt mem buf Merge in DNS/adguard-home from opt-querylog to master Squashed commit of the following: commit b4f02c3e5059833a696c0a3ddac24295a99b735a Author: Ainar Garipov Date: Mon Dec 13 21:04:54 2021 +0300 querylog: imp docs commit 4d9356a684491814afd2037eccb8791f7f37bac4 Author: Ainar Garipov Date: Mon Dec 13 21:01:40 2021 +0300 querylog: opt mem buf --- internal/querylog/qlog.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/querylog/qlog.go b/internal/querylog/qlog.go index 1ca84455..7dc38824 100644 --- a/internal/querylog/qlog.go +++ b/internal/querylog/qlog.go @@ -220,6 +220,10 @@ func (l *queryLog) Add(params *AddParams) { if !l.conf.FileEnabled { if len(l.buffer) > int(l.conf.MemSize) { // writing to file is disabled - just remove the oldest entry from array + // + // TODO(a.garipov): This should be replaced by a proper ring buffer, + // but it's currently difficult to do that. + l.buffer[0] = nil l.buffer = l.buffer[1:] } } else if !l.flushPending {