refactor(api): clarify summary ratio helper
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
21fce78ffe
commit
2f59714cce
2 changed files with 2 additions and 5 deletions
|
|
@ -112,7 +112,7 @@ func summaryResponse(p *proxy.Proxy) SummaryResponse {
|
|||
Sleep: upstreams.Sleep,
|
||||
Error: upstreams.Error,
|
||||
Total: upstreams.Total,
|
||||
Ratio: ratio(now, upstreams.Total),
|
||||
Ratio: upstreamRatio(now, upstreams.Total),
|
||||
},
|
||||
Results: ResultsResponse{
|
||||
Accepted: summary.Accepted,
|
||||
|
|
@ -181,7 +181,7 @@ func writeJSON(w http.ResponseWriter, payload any) {
|
|||
_ = json.NewEncoder(w).Encode(payload)
|
||||
}
|
||||
|
||||
func ratio(now, total uint64) float64 {
|
||||
func upstreamRatio(now, total uint64) float64 {
|
||||
if total == 0 {
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1493,6 +1493,3 @@ func (n *noopSplitter) GC() {}
|
|||
func (n *noopSplitter) Upstreams() UpstreamStats { return UpstreamStats{} }
|
||||
|
||||
// Difficulty helper for the HTTP summary.
|
||||
func workerSummaryNow(workers []WorkerRecord) uint64 {
|
||||
return uint64(len(workers))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue