FFM-11022 Flag/Group cache recovery #111
Merged
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.
What
This adds cache recovery mechanism for flags and groups in the following ways (note the recovery can't be triggered more than once per minute to avoid overloading our API):
Groups
Since a group cache lookup is determined by the flag, and if it's missing from the cache then we know the cache state is invalid, we now trigger one group cache refresh with timeout and a warning log, and attempt to evaluate one final time. If the same error occurs and we can't find the group even after a refresh, we return the default variation and log an error.
Flags
Not finding a flag in the cache doesn't necessarily mean invalid state; the user may have supplied a flag ID that doesn't exist in their project. However, if the flag can't be found we attempt one refresh of the flag cache with timeout + warning log. if it is now found, we continue with the evaluation. If it can't be found, we return the default variation.
Includes new config option
SetCacheRecoveryTimeout(int timeoutMilliseconds)
which defaults to 5 seconds.Testing