admin,templates,core: Minor enhancements and error handling (#3607)

* fix 2 possible bugs

* handle unhandled errors
This commit is contained in:
Bart
2020-07-31 22:54:18 +00:00
committed by GitHub
parent 514eef33fe
commit af5c148ed1
4 changed files with 14 additions and 5 deletions

View File

@ -401,6 +401,9 @@ func leastRequests(upstreams []*Upstream) *Upstream {
best = append(best, upstream)
}
}
if len(best) == 0 {
return nil
}
return best[weakrand.Intn(len(best))]
}