diff options
author | Erik Johnston <erik@matrix.org> | 2016-03-23 16:55:29 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-03-23 16:55:29 +0000 |
commit | 7a3815b372552e516cc3619c4ea143f610358206 (patch) | |
tree | 8ff286640cbc715ae82f7c13fcadfed218373070 /synapse/events/__init__.py | |
parent | English (diff) | |
parent | Merge pull request #666 from matrix-org/erikj/intern (diff) | |
download | synapse-7a3815b372552e516cc3619c4ea143f610358206.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.14.0
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r-- | synapse/events/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index bbfa5a7265..23f8b612ae 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -14,6 +14,7 @@ # limitations under the License. from synapse.util.frozenutils import freeze +from synapse.util.caches import intern_dict # Whether we should use frozen_dict in FrozenEvent. Using frozen_dicts prevents @@ -140,6 +141,10 @@ class FrozenEvent(EventBase): unsigned = dict(event_dict.pop("unsigned", {})) + # We intern these strings because they turn up a lot (especially when + # caching). + event_dict = intern_dict(event_dict) + if USE_FROZEN_DICTS: frozen_dict = freeze(event_dict) else: @@ -168,5 +173,7 @@ class FrozenEvent(EventBase): def __repr__(self): return "<FrozenEvent event_id='%s', type='%s', state_key='%s'>" % ( - self.event_id, self.type, self.get("state_key", None), + self.get("event_id", None), + self.get("type", None), + self.get("state_key", None), ) |