Merge current v2.11 into v3.0

This commit is contained in:
mmatur 2024-02-08 14:15:45 +01:00
commit bc84fdd006
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
143 changed files with 8736 additions and 6601 deletions

View file

@ -1,7 +1,7 @@
package tcp
import (
"fmt"
"errors"
"sync"
"github.com/rs/zerolog/log"
@ -91,7 +91,7 @@ func gcd(a, b int) int {
func (b *WRRLoadBalancer) next() (Handler, error) {
if len(b.servers) == 0 {
return nil, fmt.Errorf("no servers in the pool")
return nil, errors.New("no servers in the pool")
}
// The algo below may look messy, but is actually very simple
@ -101,7 +101,7 @@ func (b *WRRLoadBalancer) next() (Handler, error) {
// Maximum weight across all enabled servers
max := b.maxWeight()
if max == 0 {
return nil, fmt.Errorf("all servers have 0 weight")
return nil, errors.New("all servers have 0 weight")
}
// GCD across all enabled servers