diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-07-17 12:38:57 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-08-06 10:54:07 +0000 |
| commit | 7e8a1f7a0693c6b6af7b075b5bbae1f02a48c259 (patch) | |
| tree | 0b7d430bea9d107299b5251f3f7bb1a1f8fad032 /odoo | |
| parent | d6141b0777f525664a27c99f742eac9e98550300 (diff) | |
[FIX] tools: LRU doesn't have keys() method anymore
Since commit 1b30a78b, LRU is now based on OrderedDict and keys can be found
on dictionnary 'd' directly.
closes odoo/odoo#55541
X-original-commit: 3f093da75765d66ed1e2d828e8b41ed05d936d0b
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/tools/cache.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/odoo/tools/cache.py b/odoo/tools/cache.py index dce88781824..0e244f63a4b 100644 --- a/odoo/tools/cache.py +++ b/odoo/tools/cache.py @@ -2,7 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. # decorator makes wrappers that have the same API as their wrapped function -from collections import defaultdict +from collections import Counter, defaultdict from decorator import decorator from inspect import signature import logging @@ -207,10 +207,7 @@ def log_ormcache_stats(sig=None, frame=None): for dbname, reg in sorted(Registry.registries.d.items()): # set logger prefix to dbname me.dbname = dbname - entries = defaultdict(int) - # beware: we use .keys() on purpose here (reg.cache is not a real dict) - for key in reg.cache.keys(): - entries[key[:2]] += 1 + entries = Counter(k[:2] for k in reg.cache.d) # show entries sorted by model name, method name for key in sorted(entries, key=lambda key: (key[0], key[1].__name__)): model, method = key |
