Skip to content

Commit

Permalink
add sync-once func for authz when restart
Browse files Browse the repository at this point in the history
Signed-off-by: superCharge-xsy <[email protected]>
  • Loading branch information
supercharge-xsy committed Sep 6, 2024
1 parent f83283c commit d842e03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/controller/workload/workload_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ type Processor struct {
WorkloadCache cache.WorkloadCache
ServiceCache cache.ServiceCache

once sync.Once
once sync.Once
authzOnce sync.Once
}

func newProcessor(workloadMap bpf2go.KmeshCgroupSockWorkloadMaps) *Processor {
Expand Down Expand Up @@ -660,7 +661,7 @@ func (p *Processor) handleAuthorizationTypeResponse(rsp *service_discovery_v3.De
log.Debugf("remove authorization policy %s", resourceName)
}

p.once.Do(func() {
p.authzOnce.Do(func() {
p.handleRemovedAuthzPolicyDuringRestart(rbac)
})
return nil
Expand Down

0 comments on commit d842e03

Please sign in to comment.