Skip to content

Commit

Permalink
Merge pull request #96 from backguynn/main
Browse files Browse the repository at this point in the history
Troubleshooting concurrency issues
  • Loading branch information
backguynn committed Jan 24, 2024
2 parents 2e5f5b8 + 140104f commit c71a5b4
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions pkg/agent/manager/loadbalancer/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,21 +467,26 @@ func (m *Manager) addLoadBalancer(svc *corev1.Service) error {
return errors.New("no active endpoints")
}

//c.lbCache[cacheKey] = make([]api.LoadBalancerModel, 0)
m.lbCache[cacheKey] = &LbCacheEntry{
LbMode: lbMode,
ActCheck: livenessCheck,
PrefLocal: prefLocal,
Timeout: timeout,
State: "Added",
ProbeType: probeType,
ProbePort: uint16(probePort),
ProbeReq: probeReq,
ProbeResp: probeResp,
Addr: addrType,
SecIPs: []string{},
LbServicePairs: make(map[string]*LbServicePairEntry),
}
addNewLbCacheEntryChan := make(chan *LbCacheEntry)
defer close(addNewLbCacheEntryChan)
go func() {
addNewLbCacheEntryChan <- &LbCacheEntry{
LbMode: lbMode,
ActCheck: livenessCheck,
PrefLocal: prefLocal,
Timeout: timeout,
State: "Added",
ProbeType: probeType,
ProbePort: uint16(probePort),
ProbeReq: probeReq,
ProbeResp: probeResp,
Addr: addrType,
SecIPs: []string{},
LbServicePairs: make(map[string]*LbServicePairEntry),
}
}()

m.lbCache[cacheKey] = <-addNewLbCacheEntryChan
lbCacheEntry = m.lbCache[cacheKey]
klog.Infof("New LbCache %s Added", cacheKey)
}
Expand Down

0 comments on commit c71a5b4

Please sign in to comment.