diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2017-11-08 09:22:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 09:22:13 +0000 |
commit | 02a9a93bdec7bdb5fb2585e8e314002f5e55d31b (patch) | |
tree | 58ca4b4feab3cd96748de53ec03a486e1ee1791f /synapse/storage/state.py | |
parent | Merge pull request #2643 from matrix-org/matthew/user_dir_typos (diff) | |
parent | s/items/iteritems/ (diff) | |
download | synapse-02a9a93bdec7bdb5fb2585e8e314002f5e55d31b.tar.xz |
Merge pull request #2649 from matrix-org/rav/fix_delta_on_state_res
Fix bug in state group storage
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r-- | synapse/storage/state.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index 5673e4aa96..a1da3ad7a5 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -13,16 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ._base import SQLBaseStore -from synapse.util.caches.descriptors import cached, cachedList -from synapse.util.caches import intern_string -from synapse.util.stringutils import to_ascii -from synapse.storage.engines import PostgresEngine +from collections import namedtuple +import logging from twisted.internet import defer -from collections import namedtuple -import logging +from synapse.storage.engines import PostgresEngine +from synapse.util.caches import intern_string, CACHE_SIZE_FACTOR +from synapse.util.caches.descriptors import cached, cachedList +from synapse.util.caches.dictionary_cache import DictionaryCache +from synapse.util.stringutils import to_ascii +from ._base import SQLBaseStore logger = logging.getLogger(__name__) @@ -81,6 +82,10 @@ class StateStore(SQLBaseStore): where_clause="type='m.room.member'", ) + self._state_group_cache = DictionaryCache( + "*stateGroupCache*", 100000 * CACHE_SIZE_FACTOR + ) + @cached(max_entries=100000, iterable=True) def get_current_state_ids(self, room_id): """Get the current state event ids for a room based on the |