Create EncryptedRedisStructStorage#4217
Merged
zachmargolis merged 7 commits intomitchellhenke/async-proofing-calls-lg-3330from Sep 17, 2020
Merged
Create EncryptedRedisStructStorage#4217zachmargolis merged 7 commits intomitchellhenke/async-proofing-calls-lg-3330from
zachmargolis merged 7 commits intomitchellhenke/async-proofing-calls-lg-3330from
Conversation
- A mixin for storing structs in Redis that are encrypted and have an expiration
Contributor
Author
|
Merging because it's just lint failures from the main branch that are failing |
esparta
reviewed
Sep 17, 2020
esparta
left a comment
There was a problem hiding this comment.
The following suggestions are only useful iif EncryptedRedisStructStorage.load is a hot path, as in used very frequently in the system. If not, please disregard it.
|
|
||
| def key(id, type:) | ||
| if type.respond_to?(:redis_key_prefix) | ||
| [type.redis_key_prefix, id].join(':') |
There was a problem hiding this comment.
This method would create an array + string on every single call.
Suggested change
| [type.redis_key_prefix, id].join(':') | |
| type.redis_key_prefix + ":" id | |
| # or | |
| # "#{type.redis_key_prefix}:#{id}" |
| end | ||
|
|
||
| def key(id, type:) | ||
| if type.respond_to?(:redis_key_prefix) |
There was a problem hiding this comment.
I would suggest to don't ask if the type respond to redis_key_prefix. IMO it would be programmatic error[1] by failing to follow the contract, and let it fall with something similar to this:
NoMethodError (undefined method `redis_key_prefix' for DocumentCaptureSessionResult:Class)Is not as nice as the descriptive raise on line 53, but close enough to see where it's failing.
[1] Compared to user error.
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.
A mixin for storing structs in Redis that are encrypted and have an expiration
Re: https://github.com/18F/identity-idp/pull/4213/files#r490421107
This PR is just an extraction/refactor of the existing code and interface we wrote for
DocumentCaptureSessionResultI personally think
.storemight make for a good instance method instead of a class method (see below) but I didn't want to "rock the boat" that much