Skip to content

AAI-251 Better caching of RSA keys#73

Merged
marius-mather merged 4 commits into
mainfrom
better-caching
Sep 22, 2025
Merged

AAI-251 Better caching of RSA keys#73
marius-mather merged 4 commits into
mainfrom
better-caching

Conversation

@marius-mather

@marius-mather marius-mather commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

Description

AAI-251: while working on this PR I realized a lot of the slowness of our endpoints came from fetching the signing keys from Auth0 on every request. I added some basic caching for them which seems to help a lot, but this PR improves it so that we refresh the signing keys after 30 minutes, and allow for a retry on failure in case the cache is out of date.

Changes

  • Add cachetools so we can use a time-based cache
  • Cache RSA signing keys for half an hour
  • Unit tests

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)

How to Test Manually (if necessary)

Run uv run pytest

@amandazhuyilan amandazhuyilan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Thanks for the improvement!

@marius-mather marius-mather merged commit eda4b19 into main Sep 22, 2025
2 checks passed
@amandazhuyilan amandazhuyilan deleted the better-caching branch November 24, 2025 22:23
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

Successfully merging this pull request may close these issues.

2 participants