Ensure that ActiveContextCache only enters a given combination of (activeCtx, localCtx) once in its internal FIFO #44
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.
If
ActiveContextCache.set
is called multiple times during processing with a particular combination ofactiveCtx
andlocalCtx
,ActiveContextCache.order
gets out of sync withActiveContextCache.cache
(i.e., multiple copies of a particular key combination can exist inorder
even though only one copy can be cached at any given time). This causes issues later in the cache's lifecycle when it begins to evict previously set elements. The first instance of a given (activeCtx
,localCtx
) found inActiveContextCache.order
will be evicted fromActiveContextCache.cache
successfully, but subsequent copies will cause in aKeyError
. To resolve this, I made inclusion inActiveContextCache.order
conditional on the (activeCtx
,localCtx
) combination not already existing inActiveContextCache.cache
. This keeps the two data structures are in sync and prevents theKeyErrors
.