No need to create mutex on round robin upstream election if there is only one possible host
@@ -21,6 +21,10 @@ func (b *RoundrobinBalancer) Elect(hosts []*Target) (*Target, error) {
return nil, ErrEmptyBackendList
}
+ if len(hosts) == 1 {
+ return hosts[0], nil
+ }
+
if b.current >= len(hosts) {
b.current = 0
}
