Skip to content

Commit

Permalink
fix: optimize Fetch
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Dec 13, 2024
1 parent a9330e5 commit b2f2852
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions revocation/crl/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit b2f2852

Please sign in to comment.