From 67240f32633db4ee6d39e3583dce1e33a4e4d51a Mon Sep 17 00:00:00 2001 From: Anthony Regeda Date: Mon, 13 Jan 2025 13:00:02 +0100 Subject: [PATCH] feat: respect caching.inter_query_builtin_cache.stale_entry_eviction_period_seconds Signed-off-by: Anthony Regeda --- internal/internal.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/internal.go b/internal/internal.go index 9fb0f224f..b1289d33e 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -142,8 +142,12 @@ func Validate(m *plugins.Manager, bs []byte) (*Config, error) { return &cfg, nil } -// New returns a Plugin that implements the Envoy ext_authz API. +// New returns a Plugin that implements the Envoy ext_authz API with the background context. func New(m *plugins.Manager, cfg *Config) plugins.Plugin { + return newWithContext(context.Background(), m, cfg) +} + +func newWithContext(ctx context.Context, m *plugins.Manager, cfg *Config) plugins.Plugin { grpcOpts := []grpc.ServerOption{ grpc.MaxRecvMsgSize(cfg.GRPCMaxRecvMsgSize), grpc.MaxSendMsgSize(cfg.GRPCMaxSendMsgSize), @@ -168,7 +172,7 @@ func New(m *plugins.Manager, cfg *Config) plugins.Plugin { cfg: *cfg, server: grpc.NewServer(grpcOpts...), preparedQueryDoOnce: new(sync.Once), - interQueryBuiltinCache: iCache.NewInterQueryCache(m.InterQueryBuiltinCacheConfig()), + interQueryBuiltinCache: iCache.NewInterQueryCacheWithContext(ctx, m.InterQueryBuiltinCacheConfig()), distributedTracingOpts: distributedTracingOpts, }