fix: invalidate cached plans and devices on environment reload#1535
Closed
SAY-5 wants to merge 1 commit intoDiamondLightSource:mainfrom
Closed
fix: invalidate cached plans and devices on environment reload#1535SAY-5 wants to merge 1 commit intoDiamondLightSource:mainfrom
SAY-5 wants to merge 1 commit intoDiamondLightSource:mainfrom
Conversation
Closes DiamondLightSource#1503 reload_environment() previously left the @cached_property values for plans and devices populated, so accessing them after a reload returned the pre-reload data. Drop the cached entries from __dict__ so the next access recomputes against the new environment. Signed-off-by: SAY-5 <say.apm35@gmail.com>
Contributor
|
Duplicate of #1509 |
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.
Fixes #1503
Instructions to reviewer on how to test:
bc.plans/bc.devicesonce to populate the caches.bc.reload_environment().bc.plansandbc.devicesreflect the changes (newly added entries are present, removed entries are gone) without re-creating the client.Checks for reviewer
reload_environment()did not invalidate the@cached_propertyvalues forplansanddevices, so post-reload attribute access returned the pre-reload cache. Pop those entries from__dict__after the teardown so the next access recomputes against the new environment. Added a unit test that primes both caches, callsreload_environment, and asserts the caches now reflect the new server state.