Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCSP cache doesn’t have a means of clearing all cache invalidation check intervals #39

Open
aral opened this issue Apr 9, 2020 · 0 comments

Comments

@aral
Copy link

aral commented Apr 9, 2020

Use case

While running unit tests that use the OCSP cache, the Node process does not exits due to active handles (the cache expiry intervals)

Suggested fix

Add a method that clears the cache and cache expiry interval checks. e.g.,

Cache.prototype.clear = function clear() {
  var cacheIds = Object.keys(this.cache);
  cacheIds.forEach(function (cacheId) {
    clearInterval(this.cache[cacheId].timer);
  })
  this.cache.length = 0;
};

Workaround

In your app, clear the intervals manually. e.g., in my app:

const ocspCache = new ocsp.Cache()
// …
const cacheIds = Object.keys(ocspCache.cache)
cacheIds.forEach(cacheId => {
  clearInterval(ocspCache.cache[cacheId].timer)
})
@aral aral changed the title OCSP cache doesn’t have a means of clearing all cache intervals OCSP cache doesn’t have a means of clearing all cache invalidation check intervals Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant