diff options
author | Bart <[email protected]> | 2020-07-31 22:54:18 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 16:54:18 -0600 |
commit | af5c148ed1d8e405978b71e7efe15d0a829cab50 (patch) | |
tree | 688bd785a2263e66fb93797abc7a376a3c02726d /modules/caddyhttp/reverseproxy/selectionpolicies.go | |
parent | 514eef33fe6ea4e52438e62f73c8f3c0aadd45db (diff) | |
download | caddy-af5c148ed1d8e405978b71e7efe15d0a829cab50.tar.gz caddy-af5c148ed1d8e405978b71e7efe15d0a829cab50.zip |
admin,templates,core: Minor enhancements and error handling (#3607)
* fix 2 possible bugs
* handle unhandled errors
Diffstat (limited to 'modules/caddyhttp/reverseproxy/selectionpolicies.go')
-rw-r--r-- | modules/caddyhttp/reverseproxy/selectionpolicies.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go index 7c36dec2d..e33ebe476 100644 --- a/modules/caddyhttp/reverseproxy/selectionpolicies.go +++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go @@ -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))] } |