summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-03-02 10:41:35 +0000
committerKegan Dougal <kegan@matrix.org>2015-03-02 10:41:35 +0000
commitb216b3689248094989168c340b60f500c93772a7 (patch)
tree092b3470ae6d609de451fdebc82a66d66fa7325b /synapse
parentModify _simple_select_list to allow an empty WHERE clause. Use it for get_all... (diff)
downloadsynapse-b216b3689248094989168c340b60f500c93772a7.tar.xz
JOIN state_events rather than parsing unrecognized_keys to pull out member state_keys
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/appservice.py2
-rw-r--r--synapse/storage/stream.py14
2 files changed, 5 insertions, 11 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py
index 0e3eab9422..3a267d0442 100644
--- a/synapse/storage/appservice.py
+++ b/synapse/storage/appservice.py
@@ -218,7 +218,7 @@ class ApplicationServiceStore(SQLBaseStore):
         # less obvious.
 
         # get all rooms matching the room ID regex.
-        room_entries = yield self.get_all_rooms()  # RoomEntry list
+        room_entries = yield self.get_all_rooms()
         matching_room_list = set([
             r["room_id"] for r in room_entries if
             service.is_interested_in_room(r["room_id"])
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index bad427288d..865cb13e9e 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -43,7 +43,6 @@ from synapse.util.logutils import log_function
 from collections import namedtuple
 
 import logging
-import simplejson as json
 
 
 logger = logging.getLogger(__name__)
@@ -161,8 +160,9 @@ class StreamStore(SQLBaseStore):
 
         # select all the events between from/to with a sensible limit
         sql = (
-            "SELECT e.event_id, e.room_id, e.type, e.unrecognized_keys, "
-            "e.stream_ordering FROM events AS e "
+            "SELECT e.event_id, e.room_id, e.type, s.state_key, "
+            "e.stream_ordering FROM events AS e LEFT JOIN state_events as s ON "
+            "e.event_id = s.event_id "
             "WHERE e.stream_ordering > ? AND e.stream_ordering <= ? "
             "ORDER BY stream_ordering ASC LIMIT %(limit)d "
         ) % {
@@ -174,13 +174,7 @@ class StreamStore(SQLBaseStore):
                 return True
 
             if row["type"] == EventTypes.Member:
-                # load up the content to inspect if some user the AS is
-                # interested in was invited to a room. We'll be passing this
-                # through _get_events_txn later, so ignore the fact that this
-                # may be a redacted event.
-                event_content = json.loads(row["unrecognized_keys"])
-                if (service.is_interested_in_user(
-                        event_content.get("state_key"))):
+                if service.is_interested_in_user(row.get("state_key")):
                     return True
             return False