forked from TrueCloudLab/frostfs-http-gw
app: use 1 for weight if not specified or wrong
If we have a number of nodes with unspecified weights they'd all be treated equal which seems to be fair.
This commit is contained in:
parent
f019c97ce8
commit
a6f63c2bac
2 changed files with 4 additions and 1 deletions
|
@ -48,7 +48,7 @@ HTTP_GW_REQUEST_TIMEOUT=duration - Timeout for request
|
||||||
HTTP_GW_REBALANCE_TIMER=duration - Time between connections checks
|
HTTP_GW_REBALANCE_TIMER=duration - Time between connections checks
|
||||||
HTTP_GW_LISTEN_ADDRESS=host:port - Address to listen connections
|
HTTP_GW_LISTEN_ADDRESS=host:port - Address to listen connections
|
||||||
HTTP_GW_PEERS_<X>_ADDRESS=host:port - Address of NeoFS Node
|
HTTP_GW_PEERS_<X>_ADDRESS=host:port - Address of NeoFS Node
|
||||||
HTTP_GW_PEERS_<X>_WEIGHT=float - Weight of NeoFS Node
|
HTTP_GW_PEERS_<X>_WEIGHT=float - Weight of NeoFS Node (1 if not specified)
|
||||||
HTTP_GW_PPROF=bool - Enable/disable pprof (/debug/pprof)
|
HTTP_GW_PPROF=bool - Enable/disable pprof (/debug/pprof)
|
||||||
HTTP_GW_METRICS=bool - Enable/disable prometheus metrics endpoint (/metrics)
|
HTTP_GW_METRICS=bool - Enable/disable prometheus metrics endpoint (/metrics)
|
||||||
HTTP_GW_LOGGER_FORMAT=string - Logger format
|
HTTP_GW_LOGGER_FORMAT=string - Logger format
|
||||||
|
|
3
app.go
3
app.go
|
@ -108,6 +108,9 @@ func newApp(ctx context.Context, opt ...Option) App {
|
||||||
if address == "" {
|
if address == "" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if weight <= 0 { // unspecified or wrong
|
||||||
|
weight = 1
|
||||||
|
}
|
||||||
pb.AddNode(address, weight)
|
pb.AddNode(address, weight)
|
||||||
a.log.Info("add connection", zap.String("address", address), zap.Float64("weight", weight))
|
a.log.Info("add connection", zap.String("address", address), zap.Float64("weight", weight))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue