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

[SDK-2833] Fix issue where errors were being cached #268

Merged
merged 2 commits into from
Oct 8, 2021

Conversation

adamjmcgrath
Copy link
Contributor

@adamjmcgrath adamjmcgrath commented Oct 7, 2021

Description

Using the sync lru-memoizer was caching the promise per kid, rather than the result of the promise per kid. So if the first request failed, the rejected promise would stay in the cache and be reused for subsequent requests.

Have switched to the async lru-memoizer which caches the result of the async function, so if the async function fails the result will not be cached. This required a callback type signature funciton and returned a callback signature function. So the input promise function needed to be callbackified, and the output callback function needed to be promisified.

References

fixes #257

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@adamjmcgrath adamjmcgrath merged commit d65d594 into master Oct 8, 2021
@adamjmcgrath adamjmcgrath deleted the no-cache-errors branch October 8, 2021 10:26
@adamjmcgrath adamjmcgrath mentioned this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

errors thrown by the fetch function are cached and returned upon next call
2 participants