Add least time load balancing strategy
This commit is contained in:
parent
067c7e7152
commit
a754236ce5
25 changed files with 1830 additions and 134 deletions
|
|
@ -13,6 +13,8 @@ import (
|
|||
"github.com/traefik/traefik/v3/pkg/ip"
|
||||
)
|
||||
|
||||
var errNoAvailableServer = errors.New("no available server")
|
||||
|
||||
type namedHandler struct {
|
||||
http.Handler
|
||||
name string
|
||||
|
|
@ -114,15 +116,13 @@ func (b *Balancer) SetStatus(ctx context.Context, childName string, up bool) {
|
|||
// Not thread safe.
|
||||
func (b *Balancer) RegisterStatusUpdater(fn func(up bool)) error {
|
||||
if !b.wantsHealthCheck {
|
||||
return errors.New("healthCheck not enabled in config for this weighted service")
|
||||
return errors.New("healthCheck not enabled in config for this HRW service")
|
||||
}
|
||||
b.updaters = append(b.updaters, fn)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var errNoAvailableServer = errors.New("no available server")
|
||||
|
||||
func (b *Balancer) nextServer(ip string) (*namedHandler, error) {
|
||||
b.handlersMu.RLock()
|
||||
var healthy []*namedHandler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue