From f5abaafabdd9cce67325edbb27c134fd6c7babd7 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 20 Dec 2016 11:49:25 +0000 Subject: uncommitted changes on matrix.org These might be important? who knows? --- synapse/handlers/room_list.py | 10 +++++----- synapse/storage/event_push_actions.py | 4 ++-- synapse/storage/roommember.py | 4 ++-- synapse/storage/search.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py index 1e883b23f6..242e646e5c 100644 --- a/synapse/handlers/room_list.py +++ b/synapse/handlers/room_list.py @@ -42,7 +42,7 @@ EMTPY_THIRD_PARTY_ID = ThirdPartyInstanceID(None, None) class RoomListHandler(BaseHandler): def __init__(self, hs): super(RoomListHandler, self).__init__(hs) - self.response_cache = ResponseCache(hs) + self.response_cache = ResponseCache(hs, timeout_ms=10 * 60 * 1000) self.remote_response_cache = ResponseCache(hs, timeout_ms=30 * 1000) def get_local_public_room_list(self, limit=None, since_token=None, @@ -62,18 +62,18 @@ class RoomListHandler(BaseHandler): appservice and network id to use an appservice specific one. Setting to None returns all public rooms across all lists. """ - if search_filter or network_tuple is not (None, None): + if search_filter: # We explicitly don't bother caching searches or requests for # appservice specific lists. return self._get_public_room_list( limit, since_token, search_filter, network_tuple=network_tuple, ) - result = self.response_cache.get((limit, since_token)) + result = self.response_cache.get((limit, since_token, network_tuple)) if not result: result = self.response_cache.set( - (limit, since_token), - self._get_public_room_list(limit, since_token) + (limit, since_token, network_tuple), + self._get_public_room_list(limit, since_token, network_tuple=network_tuple) ) return result diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py index 7de3e8c58c..1874737674 100644 --- a/synapse/storage/event_push_actions.py +++ b/synapse/storage/event_push_actions.py @@ -101,11 +101,11 @@ class EventPushActionsStore(SQLBaseStore): # notif=1 sql = ( "SELECT count(*)" - " FROM event_push_actions ea" + " FROM (SELECT * FROM event_push_actions" " WHERE" " user_id = ?" " AND room_id = ?" - " AND %s" + " AND %s LIMIT 100) as ea" ) % (lower_bound(token, self.database_engine, inclusive=False),) txn.execute(sql, (user_id, room_id)) diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 63e8c32903..946d5a81cc 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -483,9 +483,9 @@ class RoomMemberStore(SQLBaseStore): def add_membership_profile_txn(txn): sql = (""" - SELECT stream_ordering, event_id, room_id, content + SELECT stream_ordering, event_id, events.room_id, content FROM events - INNER JOIN room_memberships USING (room_id, event_id) + INNER JOIN room_memberships USING (event_id) WHERE ? <= stream_ordering AND stream_ordering < ? AND type = 'm.room.member' ORDER BY stream_ordering DESC diff --git a/synapse/storage/search.py b/synapse/storage/search.py index 8f2b3c4435..17c6c55714 100644 --- a/synapse/storage/search.py +++ b/synapse/storage/search.py @@ -600,7 +600,7 @@ def _parse_query(database_engine, search_term): results = re.findall(r"([\w\-]+)", search_term, re.UNICODE) if isinstance(database_engine, PostgresEngine): - return " & ".join(result + ":*" for result in results) + return " & ".join(result for result in results) elif isinstance(database_engine, Sqlite3Engine): return " & ".join(result + "*" for result in results) else: -- cgit 1.4.1