diff options
author | Neil Johnson <neil@fragile.org.uk> | 2018-03-20 14:25:31 +0000 |
---|---|---|
committer | Neil Johnson <neil@fragile.org.uk> | 2018-03-20 14:25:31 +0000 |
commit | e66fbcbb02d98a0d165f3c5d4642d26add233562 (patch) | |
tree | 01b5c79c3951f31d5826a852f49aa312d8e47604 /synapse/util/caches/dictionary_cache.py | |
parent | Update __init__.py (diff) | |
parent | Merge pull request #3005 from matrix-org/erikj/fix_cache_size (diff) | |
download | synapse-e66fbcbb02d98a0d165f3c5d4642d26add233562.tar.xz |
fix merge conflicts
Diffstat (limited to 'synapse/util/caches/dictionary_cache.py')
-rw-r--r-- | synapse/util/caches/dictionary_cache.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/util/caches/dictionary_cache.py b/synapse/util/caches/dictionary_cache.py index d4105822b3..1709e8b429 100644 --- a/synapse/util/caches/dictionary_cache.py +++ b/synapse/util/caches/dictionary_cache.py @@ -132,9 +132,13 @@ class DictionaryCache(object): self._update_or_insert(key, value, known_absent) def _update_or_insert(self, key, value, known_absent): - entry = self.cache.setdefault(key, DictionaryEntry(False, set(), {})) + # We pop and reinsert as we need to tell the cache the size may have + # changed + + entry = self.cache.pop(key, DictionaryEntry(False, set(), {})) entry.value.update(value) entry.known_absent.update(known_absent) + self.cache[key] = entry def _insert(self, key, value, known_absent): self.cache[key] = DictionaryEntry(True, known_absent, value) |