Merge: -(dnsforward): fixing an issue with the querylog speed
Squashed commit of the following: commit 7db062d2ce40369fc6c7eaa89f678c660d531516 Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 27 12:08:58 2020 +0300 *(dnsforward): added comment about oldest commit dbec84d8a8c60ca040faa59f8aa818ed5959e92a Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Feb 27 11:16:58 2020 +0300 fix commit d6df1ee28b3918e8d1676ff6ab4b516d46fe4202 Author: Andrey Meshkov <am@adguard.com> Date: Wed Feb 26 20:42:11 2020 +0300 -(dnsforward): fixing an issue with the querylog speed
This commit is contained in:
@@ -231,6 +231,13 @@ func (l *queryLog) getData(params getDataParams) map[string]interface{} {
|
||||
// remove extra records
|
||||
entries = entries[(len(entries) - getDataLimit):]
|
||||
}
|
||||
if len(entries) == getDataLimit {
|
||||
// change the "oldest" value here.
|
||||
// we cannot use the "oldest" we got from "searchFiles" anymore
|
||||
// because after adding in-memory records and removing extra records
|
||||
// the situation has changed
|
||||
oldest = entries[len(entries)-1].Time
|
||||
}
|
||||
|
||||
// init the response object
|
||||
var data = []map[string]interface{}{}
|
||||
@@ -246,9 +253,6 @@ func (l *queryLog) getData(params getDataParams) map[string]interface{} {
|
||||
len(entries), total, params.OlderThan, time.Since(now))
|
||||
|
||||
var result = map[string]interface{}{}
|
||||
if len(entries) == getDataLimit {
|
||||
oldest = entries[0].Time
|
||||
}
|
||||
result["oldest"] = ""
|
||||
if !oldest.IsZero() {
|
||||
result["oldest"] = oldest.Format(time.RFC3339Nano)
|
||||
|
||||
Reference in New Issue
Block a user