From b2f2852fa217690072ec53e8142ef45366ee5351 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Fri, 13 Dec 2024 09:41:47 +0000 Subject: [PATCH] fix: optimize Fetch Signed-off-by: Junjie Gao --- revocation/crl/fetcher.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/revocation/crl/fetcher.go b/revocation/crl/fetcher.go index e0c7bc71..7ea5b0ff 100644 --- a/revocation/crl/fetcher.go +++ b/revocation/crl/fetcher.go @@ -90,8 +90,7 @@ func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (*Bundle, error) { bundle, err := f.Cache.Get(ctx, url) if err == nil { // check expiry of base CRL and delta CRL - if (bundle.BaseCRL != nil && isEffective(bundle.BaseCRL)) && - (bundle.DeltaCRL == nil || isEffective(bundle.DeltaCRL)) { + if isEffective(bundle.BaseCRL) && (bundle.DeltaCRL == nil || isEffective(bundle.DeltaCRL)) { return bundle, nil } } else if !errors.Is(err, ErrCacheMiss) && !f.DiscardCacheError { @@ -143,7 +142,6 @@ func (f *HTTPFetcher) fetch(ctx context.Context, url string) (*Bundle, error) { // // It returns errDeltaCRLNotFound if the delta CRL is not found. func (f *HTTPFetcher) fetchDeltaCRL(ctx context.Context, extensions []pkix.Extension) (*x509.RevocationList, error) { - idx := slices.IndexFunc(extensions, func(ext pkix.Extension) bool { return ext.Id.Equal(oidFreshestCRL) })