Skip to content

Commit 64ca826

Browse files
committed
fix multisource error
1 parent 5f4a6af commit 64ca826

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

factory/multisource.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ type DefaultMultiSource struct {
4949

5050
func NewMultiSource(t LoadBalanceType) *DefaultMultiSource {
5151
return &DefaultMultiSource{
52-
actionMaps: map[string]loadbalance.LoadBalance{},
53-
lbType: int(t),
52+
actionMaps: map[string]loadbalance.LoadBalance{},
53+
factoryMaps: map[Factory]loadbalance.LoadBalance{},
54+
lbType: int(t),
5455
}
5556
}
5657

@@ -64,6 +65,7 @@ func (lb *DefaultMultiSource) Bind(action string, weight int, factory Factory) {
6465
} else {
6566
if f, ok := lb.factoryMaps[factory]; ok {
6667
lb.actionMaps[action] = f
68+
lb.factoryMaps[factory] = f
6769
} else {
6870
newlb := loadbalance.Create(lb.lbType)
6971
newlb.Add(weight, factory)

0 commit comments

Comments
 (0)