Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store._loadedItem returns stale Item from Store.objectCache #92

Open
ldanielburr opened this issue Oct 25, 2018 · 0 comments
Open

Store._loadedItem returns stale Item from Store.objectCache #92

ldanielburr opened this issue Oct 25, 2018 · 0 comments

Comments

@ldanielburr
Copy link
Contributor

When a Store instance in process A has an Item instance cached in its objectCache, changes to the underlying database row in process B will not be reflected unless the cache entry expires. In some cases, this may never happen, resulting in the stale Item being cached until the Store instance in process A is closed/reopened, or process A is restarted, etc.

Based on the comment on line 1750, "# XXX do checks on consistency between attrs and DB object, maybe?", it seems possible to compare the values returned from the database with the attributes of the cached Item instance, and if they do not match, update the Item instance in-place.

Alternately, we could just uncache the Item instance and raise KeyError, which would cause a new Item instance to be created via the call to existingInStore. I think I prefer the "update in-place" solution myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant