Skip to content

Commit 69e1734

Browse files
committed
Apply FallbackTag to leastping and roundrobin
1 parent 5c41292 commit 69e1734

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

app/router/config.go

+16-12
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,17 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
126126
switch strings.ToLower(br.Strategy) {
127127
case "leastping":
128128
return &Balancer{
129-
selectors: br.OutboundSelector,
130-
strategy: &LeastPingStrategy{},
131-
ohm: ohm,
129+
selectors: br.OutboundSelector,
130+
strategy: &LeastPingStrategy{},
131+
fallbackTag: br.FallbackTag,
132+
ohm: ohm,
132133
}, nil
133134
case "roundrobin":
134135
return &Balancer{
135-
selectors: br.OutboundSelector,
136-
strategy: &RoundRobinStrategy{},
137-
ohm: ohm,
136+
selectors: br.OutboundSelector,
137+
strategy: &RoundRobinStrategy{},
138+
fallbackTag: br.FallbackTag,
139+
ohm: ohm,
138140
}, nil
139141
case "leastload":
140142
i, err := br.StrategySettings.GetInstance()
@@ -147,17 +149,19 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
147149
}
148150
leastLoadStrategy := NewLeastLoadStrategy(s)
149151
return &Balancer{
150-
selectors: br.OutboundSelector,
151-
ohm: ohm, fallbackTag: br.FallbackTag,
152-
strategy: leastLoadStrategy,
152+
selectors: br.OutboundSelector,
153+
ohm: ohm,
154+
fallbackTag: br.FallbackTag,
155+
strategy: leastLoadStrategy,
153156
}, nil
154157
case "random":
155158
fallthrough
156159
case "":
157160
return &Balancer{
158-
selectors: br.OutboundSelector,
159-
ohm: ohm, fallbackTag: br.FallbackTag,
160-
strategy: &RandomStrategy{},
161+
selectors: br.OutboundSelector,
162+
ohm: ohm,
163+
fallbackTag: br.FallbackTag,
164+
strategy: &RandomStrategy{},
161165
}, nil
162166
default:
163167
return nil, newError("unrecognized balancer type")

0 commit comments

Comments
 (0)