mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
Optimize policy iterators (#5184)
* Optimize policy iterators (go1.23) This modifies (*Options).GetAllPolicies() to use a go 1.23 iterator instead of copying all policies on every call, which can be extremely expensive. All existing usages of this function were updated as necessary. Additionally, a new (*Options).NumPolicies() method was added which quickly computes the number of policies that would be given by GetAllPolicies(), since there were several usages where only the number of policies was needed. * Fix race condition when assigning default envoy opts to a policy
This commit is contained in:
parent
3961098681
commit
56ba07e53e
16 changed files with 136 additions and 87 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
type evaluatorConfig struct {
|
||||
Policies []config.Policy `hash:"-"`
|
||||
Policies []*config.Policy `hash:"-"`
|
||||
ClientCA []byte
|
||||
ClientCRL []byte
|
||||
AddDefaultClientCertificateRule bool
|
||||
|
@ -34,7 +34,7 @@ func getConfig(options ...Option) *evaluatorConfig {
|
|||
}
|
||||
|
||||
// WithPolicies sets the policies in the config.
|
||||
func WithPolicies(policies []config.Policy) Option {
|
||||
func WithPolicies(policies []*config.Policy) Option {
|
||||
return func(cfg *evaluatorConfig) {
|
||||
cfg.Policies = policies
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue