mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 21:15:35 +03:00
Merge pull request #83 in DNS/adguard-dns from avg_time_fix to master
* commit '1ed9faa0c22c1ae9ec2043c80e697133688cea40': Fix API returning wrong average request time
This commit is contained in:
commit
dca9aebccb
1 changed files with 8 additions and 0 deletions
|
@ -242,6 +242,14 @@ func handleStats(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
summed[key] = summedValue
|
||||
}
|
||||
// don't forget to divide by number of elements in returned slice
|
||||
if val, ok := summed["avg_processing_time"]; ok {
|
||||
if flval, flok := val.(float64); flok {
|
||||
flval /= float64(len(histrical))
|
||||
summed["avg_processing_time"] = flval
|
||||
}
|
||||
}
|
||||
|
||||
summed["stats_period"] = "24 hours"
|
||||
|
||||
json, err := json.Marshal(summed)
|
||||
|
|
Loading…
Reference in a new issue