Invalidate rendered documents cache when deleting all revisions
When DELETE /revisions is called all revisions are deleted from the DB, which means that all cached documents for each revision should be cleared from memory. This patch set addresses this issue. This is part of a set of patch sets aimed at fixing edge cases like this so rendered documents are always returned correctly. In the same vein, invalidation is performed for Barbican secrets, for the same endpoint above. Change-Id: I0334b638d6ce7569e8771e960dd283b1a85a5a6b
This commit is contained in:
parent
d2f2eefbdb
commit
6dfd43d207
@ -16,6 +16,8 @@ import functools
|
||||
|
||||
import falcon
|
||||
|
||||
from deckhand.engine import cache as engine_cache
|
||||
|
||||
|
||||
class ViewBuilder(object):
|
||||
"""Model API responses as dictionaries."""
|
||||
@ -119,3 +121,8 @@ def sanitize_params(allowed_params):
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def invalidate_cache_data():
|
||||
"""Invalidate all data associated with document rendering."""
|
||||
engine_cache.invalidate()
|
||||
|
@ -87,7 +87,7 @@ class RevisionsResource(api_base.BaseResource):
|
||||
|
||||
@policy.authorize('deckhand:delete_revisions')
|
||||
def on_delete(self, req, resp):
|
||||
self._delete_all_barbican_secrets()
|
||||
|
||||
db_api.revision_delete_all()
|
||||
self._delete_all_barbican_secrets() # Delete all Barbican secrets.
|
||||
db_api.revision_delete_all() # Delete all revisions.
|
||||
common.invalidate_cache_data() # Invalidate all cached data.
|
||||
resp.status = falcon.HTTP_204
|
||||
|
Loading…
Reference in New Issue
Block a user