Skip to content

Commit

Permalink
*(dnsforward): added comment about oldest
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Feb 27, 2020
1 parent dbec84d commit 7db062d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions querylog/qlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
Expand All @@ -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[len(entries)-1].Time
}
result["oldest"] = ""
if !oldest.IsZero() {
result["oldest"] = oldest.Format(time.RFC3339Nano)
Expand Down

0 comments on commit 7db062d

Please sign in to comment.