Fix: race condition in caching layer #218
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.
Description
This fixes a bit of a subtle bug in the caching layer where the SDK can start to return empty sets of flags if the cache is invalidated between checking the cache status and doing the actual retrieve. This forces the read from cache to be atomic.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Custom script - spin up 50 processes each running their own SDK, backed by Redis all checking a feature that should always be enabled. This typically produces a false result in 10-20 seconds. Apply fix rerun script for 20 minutes.
Checklist: