Make sure the cache is ensured before manipulating it
This commit is contained in:
parent
a6043ba8d5
commit
fae270a1d6
@ -133,6 +133,11 @@ class ElementCache:
|
||||
|
||||
Returns the new generated change_id.
|
||||
"""
|
||||
if not self.ensured:
|
||||
raise RuntimeError(
|
||||
"Call element_cache.ensure_cache before changing elements."
|
||||
)
|
||||
|
||||
deleted_elements = []
|
||||
changed_elements = []
|
||||
for element_id, data in elements.items():
|
||||
@ -265,6 +270,11 @@ class ElementCache:
|
||||
# If the restricted_data_cache is not used, there is nothing to do
|
||||
return
|
||||
|
||||
if not self.ensured:
|
||||
raise RuntimeError(
|
||||
"Call element_cache.ensure_cache before updating restricted data."
|
||||
)
|
||||
|
||||
# Try to write a special key.
|
||||
# If this succeeds, there is noone else currently updating the cache.
|
||||
# TODO: Make a timeout. Else this could block forever
|
||||
|
Loading…
Reference in New Issue
Block a user