summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-23 16:13:05 +0000
committerErik Johnston <erik@matrix.org>2016-03-23 16:25:54 +0000
commitacdfef7b1443a8260c43e31e9944b74dfdf286dc (patch)
treecba181b0c3da5e0b53e76e45e71bbba510c09f15 /synapse/events
parentIntern sender, event_id and room_id in events (diff)
downloadsynapse-acdfef7b1443a8260c43e31e9944b74dfdf286dc.tar.xz
Intern all the things
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/__init__.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index 63004eaf04..23f8b612ae 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 from synapse.util.frozenutils import freeze
-from synapse.util.caches import intern_string
+from synapse.util.caches import intern_dict
 
 
 # Whether we should use frozen_dict in FrozenEvent. Using frozen_dicts prevents
@@ -143,14 +143,7 @@ class FrozenEvent(EventBase):
 
         # We intern these strings because they turn up a lot (especially when
         # caching).
-        event_dict["type"] = intern_string(event_dict["type"])
-        if "state_key" in event_dict:
-            event_dict["state_key"] = intern_string(event_dict["state_key"])
-        if "sender" in event_dict:
-            event_dict["sender"] = intern_string(event_dict["sender"])
-
-        event_dict["event_id"] = intern(event_dict["event_id"].encode('ascii'))
-        event_dict["room_id"] = intern(event_dict["room_id"].encode('ascii'))
+        event_dict = intern_dict(event_dict)
 
         if USE_FROZEN_DICTS:
             frozen_dict = freeze(event_dict)