Evaluate Proc namespaces every time (not just at initialization)#923
Merged
petergoldstein merged 1 commit intopetergoldstein:mainfrom Jun 28, 2022
marketplacer:nigelw/evaluate-proc-namespace-every-time
Merged
Evaluate Proc namespaces every time (not just at initialization)#923petergoldstein merged 1 commit intopetergoldstein:mainfrom marketplacer:nigelw/evaluate-proc-namespace-every-time
petergoldstein merged 1 commit intopetergoldstein:mainfrom
marketplacer:nigelw/evaluate-proc-namespace-every-time
Conversation
When creating a dalli client with a Proc for the namespace option, it would generally mean that the namespace may change from operation to operation. Saving the result of calling the proc in the KeyManager instance at initialisation time means that the client will always use the value of the namespace as it was when the client was created. If this was the desired behaviour, it would be just as easy to pass that value as a string instead of a Proc.
Owner
|
@nrw505 This all looks correct. Thanks for catching the issue and contributing a fix. Merging. |
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.
When creating a dalli client with a Proc for the namespace option, it
would generally mean that the namespace may change from operation to
operation. Saving the result of calling the proc in the KeyManager
instance at initialisation time means that the client will always use
the value of the namespace as it was when the client was created. If
this was the desired behaviour, it would be just as easy to pass that
value as a string instead of a Proc.
Given test/test_key_manager.rb:69 is passing a namespace_as_symbol instead of namespace_as_proc, I'm assuming this is an unintended regression from when this logic was pulled out into KeyManager