Add a comment explaining ordering when disabling policies (#29961)

For #29958 

Adds a comment to address PR comment in prior PR.
This commit is contained in:
Jordan Montgomery 2025-06-12 11:39:49 -04:00 committed by GitHub
parent eec2c315f3
commit 36e1edc04f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -811,6 +811,8 @@ func (svc *Service) policyQueriesForHost(ctx context.Context, host *fleet.Host)
if !svc.shouldUpdate(policyReportedAt, svc.config.Osquery.PolicyUpdateInterval, host.ID) && !host.RefetchRequested {
return nil, false, nil
}
// This must come after the check above to avoid unnecessary queries to the database. Most
// requests from live connected hosts will not reach this point
disablePolicies, err := svc.disablePoliciesDuringSetupExperience(ctx, host)
if err != nil {
return nil, false, ctxerr.Wrap(ctx, err, "check if host is in setup experience")