Store AAMVA tokens in Rails.cache instead of behind an application mutex#8330
Merged
mitchellhenke merged 1 commit intomainfrom May 4, 2023
Merged
Conversation
zachmargolis
reviewed
May 3, 2023
029c79e to
aa99969
Compare
zachmargolis
reviewed
May 3, 2023
078537d to
7f97458
Compare
Sgtpluck
reviewed
May 4, 2023
Contributor
There was a problem hiding this comment.
oh i really like just having the cache handle the expiration
Contributor
Author
There was a problem hiding this comment.
There's also a chance this reduces the number of requests to AAMVA for tokens since the mutex would have been a local cache for an individual web server process, but moving it to Rails.cache (backed by Redis) will allow all instances to share the token.
changelog: Internal, AAMVA Proofing, Store AAMVA tokens in Rails.cache instead of behind an application mutex Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
7f97458 to
3b1350a
Compare
Sgtpluck
approved these changes
May 4, 2023
Contributor
|
Thank you for fixing this! 🙏🏻 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
We are seeing some test flakiness due to the token being stored in a mutex that is not cleared between tests and it can create different states for different tests depending on the order they run. This PR moves the token storage to
Rails.cacheand relies on it to handle writing and expiration of the token.The mutex looks to originate from the original implementation of the AAMVA client.
Slack discussion, CI Example Failure 1, CI Example Failure 2
The flaky test can be reproduced reliably with: