Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Cancelling invalidation of cache #923

Merged
merged 1 commit into from
Nov 19, 2018
Merged

Conversation

StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Oct 3, 2018

Under normal operation a user interface interaction will query the cache for data. If the data in the cache is out of date, the cache will be invalidated. after which the RepositoryManager and User objects respectively start the appropriate task(s) to refresh and update the cache. To prevent multiple calls to refresh and update the cache, a flag isInvalidating, is set. When the cache is refreshed, the user interface will receive an event indicating as much and will reload the display from the cache.

It is possible that an error occurs after the cache is invalidated and the process to refresh and update the cache fails. In that case a user will be "stuck", be cause the isInvalidating flag is never set to false. And further queries of the cache will not spur the actions to refresh it.

This pull request adds error handlers to the tasks initiated by RepositoryManager and User in order to "cancel" the invalidation process by setting the isInvalidating flag to false. Allowing further user interface actions to attempt to reload the data.

Depends on:

Correctly handling errors with tasks

Cleanup

Adding an additional warning message

Avoid creating a new lambda for every invalidation
@shana shana force-pushed the fixes/cache-invalidation-error branch from cbbee77 to e20054e Compare November 19, 2018 15:44
@shana shana merged commit f4dc0c4 into master Nov 19, 2018
@shana shana deleted the fixes/cache-invalidation-error branch November 19, 2018 16:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants