Clear all cache after module loaded

As we rollback the cache modification when loading a module, we must clear all
of them at the end to ensure to not keep outdated data.

issue9759
review339421002
This commit is contained in:
Cédric Krier committed 2021-01-13 00:26:53 +01:00
1 parent 2ab80aff35
commit 421ec76c49
4 files changed
+13

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Add clear_all method to Cache
* Support Genshi element directives in HTML editor
* Add firstline tool
* Add support for Python 3.9
+4
View File
@@ -35,6 +35,10 @@ Sets the ``value`` of the ``key`` in the cache.
Clears all the keys in the cache.
.. classmethod:: clear_all()
Clears all cache instances.
.. classmethod:: sync(transaction)
Synchronize cache instances using transaction.
+5
View File
@@ -75,6 +75,11 @@ class BaseCache(object):
def clear(self):
raise NotImplementedError
@classmethod
def clear_all(cls):
for inst in cls._instances.values():
inst.clear()
@classmethod
def sync(cls, transaction):
raise NotImplementedError
+3
View File
@@ -299,6 +299,9 @@ def load_module_graph(graph, pool, update=None, lang=None):
while modules_todo:
(module, to_delete) = modules_todo.pop()
convert.post_import(pool, module, to_delete)
# Ensure cache is clear for other instances
Cache.clear_all()
logger.info('all modules loaded')