Skip to content

Instantly share code, notes, and snippets.

@odony
Created January 29, 2021 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save odony/675d25b129c7476a3784a7b87ddc4490 to your computer and use it in GitHub Desktop.
Save odony/675d25b129c7476a3784a7b87ddc4490 to your computer and use it in GitHub Desktop.
registry: avoid phantom cache signaling
diff --git odoo/modules/registry.py odoo/modules/registry.py
index 907e13ef4ae5..c3c317b77f0d 100644
--- odoo/modules/registry.py
+++ odoo/modules/registry.py
@@ -616,7 +616,6 @@ class Registry(Mapping):
if self.cache_sequence != c:
_logger.info("Invalidating all model caches after database signaling.")
self._clear_cache()
- self.cache_invalidated = False
if self.cache_longterm_sequence != cl:
_logger.info("Invalidating longterm cache after database signaling.")
self._clear_cache_longterm()
@@ -625,6 +624,10 @@ class Registry(Mapping):
self.cache_sequence = c
self.cache_longterm_sequence = cl
+ # prevent re-signaling the reactive clear_cache() above, or any residual one that
+ # would be inherited from the master process (for the first request in pre-fork mode)
+ self.cache_invalidated = False
+
return self
def signal_changes(self):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment