upstream endpoints load balancer weights (#1830)

This commit is contained in:
wasaga 2021-01-28 09:11:14 -05:00 committed by GitHub
parent 3567183ce5
commit 67f6030e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1190 additions and 778 deletions

View file

@ -83,7 +83,14 @@ func (src *ConfigSource) rebuild(firstTime bool) {
seen := map[uint64]struct{}{}
for _, policy := range cfg.Options.GetAllPolicies() {
seen[policy.RouteID()] = struct{}{}
id, err := policy.RouteID()
if err != nil {
log.Warn().Err(err).
Str("policy", policy.String()).
Msg("databroker: invalid policy config, ignoring")
return
}
seen[id] = struct{}{}
}
var additionalPolicies []config.Policy
@ -113,7 +120,13 @@ func (src *ConfigSource) rebuild(firstTime bool) {
continue
}
routeID := policy.RouteID()
routeID, err := policy.RouteID()
if err != nil {
log.Warn().Err(err).
Str("policy", policy.String()).
Msg("databroker: cannot establish policy route ID, ignoring")
continue
}
if _, ok := seen[routeID]; ok {
log.Warn().Err(err).