Skip to content

Commit

Permalink
Don't scan for posture checks if there are 0 posture checks in the sy…
Browse files Browse the repository at this point in the history
…stem. Fixes #1576
  • Loading branch information
plorenz committed Dec 11, 2023
1 parent 08a8449 commit 94d39c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controller/model/edge_service_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ type PolicyPostureChecks struct {

func (self *EdgeServiceManager) GetPolicyPostureChecks(identityId, serviceId string) map[string]*PolicyPostureChecks {
policyIdToChecks := map[string]*PolicyPostureChecks{}

postureCheckCache := map[string]*PostureCheck{}

servicePolicyStore := self.env.GetStores().ServicePolicy
Expand All @@ -339,6 +340,10 @@ func (self *EdgeServiceManager) GetPolicyPostureChecks(identityId, serviceId str
policyTypeSymbol := self.env.GetStores().ServicePolicy.GetSymbol(db.FieldServicePolicyType)

_ = self.GetDb().View(func(tx *bbolt.Tx) error {
if !self.env.GetStores().PostureCheck.IterateIds(tx, ast.BoolNodeTrue).IsValid() {
return nil
}

policyCursor := self.env.GetStores().Identity.GetRelatedEntitiesCursor(tx, identityId, db.EntityTypeServicePolicies, true)
policyCursor = ast.NewFilteredCursor(policyCursor, func(policyId []byte) bool {
return serviceLinks.IsLinked(tx, policyId, []byte(serviceId))
Expand Down

0 comments on commit 94d39c3

Please sign in to comment.