forked from TrueCloudLab/frostfs-http-gw
[#115] Update sdk version to support priority
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
1bb6c5f384
commit
71e846a4fc
7 changed files with 50 additions and 102 deletions
9
app.go
9
app.go
|
@ -103,14 +103,19 @@ func newApp(ctx context.Context, opt ...Option) App {
|
|||
for i := 0; ; i++ {
|
||||
address := a.cfg.GetString(cfgPeers + "." + strconv.Itoa(i) + ".address")
|
||||
weight := a.cfg.GetFloat64(cfgPeers + "." + strconv.Itoa(i) + ".weight")
|
||||
priority := a.cfg.GetInt(cfgPeers + "." + strconv.Itoa(i) + ".priority")
|
||||
if address == "" {
|
||||
break
|
||||
}
|
||||
if weight <= 0 { // unspecified or wrong
|
||||
weight = 1
|
||||
}
|
||||
pb.AddNode(address, weight)
|
||||
a.log.Info("add connection", zap.String("address", address), zap.Float64("weight", weight))
|
||||
if priority <= 0 { // unspecified or wrong
|
||||
priority = 1
|
||||
}
|
||||
pb.AddNode(address, priority, weight)
|
||||
a.log.Info("add connection", zap.String("address", address),
|
||||
zap.Float64("weight", weight), zap.Int("priority", priority))
|
||||
}
|
||||
opts := &pool.BuilderOptions{
|
||||
Key: key,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue