Skip to content

Commit

Permalink
Bugfix: Call waitgroup.Add before any consumption on the waitgroup in…
Browse files Browse the repository at this point in the history
… VPC service initialization (#945)
  • Loading branch information
wenyingd authored Dec 6, 2024
1 parent 12859ca commit 21d1300
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/nsx/services/vpc/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ func InitializeVPC(service common.Service) (*VPCService, error) {
VPCService.VPCNSNetworkConfigStore = VPCNsNetworkConfigStore{
VPCNSNetworkConfigMap: make(map[string]string),
}

// Note: waitgroup.Add must be called before its consumptions.
wg.Add(2)
// initialize vpc store, lbs store
go VPCService.InitializeResourceStore(&wg, fatalErrors, common.ResourceTypeVpc, nil, VPCService.VpcStore)
go VPCService.InitializeResourceStore(&wg, fatalErrors, common.ResourceTypeLBService, nil, VPCService.LbsStore)

wg.Add(2)
go func() {
wg.Wait()
close(wgDone)
Expand Down

0 comments on commit 21d1300

Please sign in to comment.