mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 17:10:43 +03:00
merge uncommitted changes from matrix.org into hotfixes-v0.18.5
This commit is contained in:
commit
2998fa57b0
3 changed files with 8 additions and 10 deletions
|
@ -42,7 +42,7 @@ EMTPY_THIRD_PARTY_ID = ThirdPartyInstanceID(None, None)
|
||||||
class RoomListHandler(BaseHandler):
|
class RoomListHandler(BaseHandler):
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(RoomListHandler, self).__init__(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)
|
self.remote_response_cache = ResponseCache(hs, timeout_ms=30 * 1000)
|
||||||
|
|
||||||
def get_local_public_room_list(self, limit=None, since_token=None,
|
def get_local_public_room_list(self, limit=None, since_token=None,
|
||||||
|
@ -62,20 +62,18 @@ class RoomListHandler(BaseHandler):
|
||||||
appservice and network id to use an appservice specific one.
|
appservice and network id to use an appservice specific one.
|
||||||
Setting to None returns all public rooms across all lists.
|
Setting to None returns all public rooms across all lists.
|
||||||
"""
|
"""
|
||||||
if search_filter or (network_tuple and network_tuple.appservice_id is not None):
|
if search_filter:
|
||||||
# We explicitly don't bother caching searches or requests for
|
# We explicitly don't bother caching searches or requests for
|
||||||
# appservice specific lists.
|
# appservice specific lists.
|
||||||
return self._get_public_room_list(
|
return self._get_public_room_list(
|
||||||
limit, since_token, search_filter, network_tuple=network_tuple,
|
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:
|
if not result:
|
||||||
result = self.response_cache.set(
|
result = self.response_cache.set(
|
||||||
(limit, since_token),
|
(limit, since_token, network_tuple),
|
||||||
self._get_public_room_list(
|
self._get_public_room_list(limit, since_token, network_tuple=network_tuple)
|
||||||
limit, since_token, network_tuple=network_tuple
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,11 @@ class EventPushActionsStore(SQLBaseStore):
|
||||||
# notif=1
|
# notif=1
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT count(*)"
|
"SELECT count(*)"
|
||||||
" FROM event_push_actions ea"
|
" FROM (SELECT * FROM event_push_actions"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" user_id = ?"
|
" user_id = ?"
|
||||||
" AND room_id = ?"
|
" AND room_id = ?"
|
||||||
" AND %s"
|
" AND %s LIMIT 100) as ea"
|
||||||
) % (lower_bound(token, self.database_engine, inclusive=False),)
|
) % (lower_bound(token, self.database_engine, inclusive=False),)
|
||||||
|
|
||||||
txn.execute(sql, (user_id, room_id))
|
txn.execute(sql, (user_id, room_id))
|
||||||
|
|
|
@ -600,7 +600,7 @@ def _parse_query(database_engine, search_term):
|
||||||
results = re.findall(r"([\w\-]+)", search_term, re.UNICODE)
|
results = re.findall(r"([\w\-]+)", search_term, re.UNICODE)
|
||||||
|
|
||||||
if isinstance(database_engine, PostgresEngine):
|
if isinstance(database_engine, PostgresEngine):
|
||||||
return " & ".join(result + ":*" for result in results)
|
return " & ".join(result for result in results)
|
||||||
elif isinstance(database_engine, Sqlite3Engine):
|
elif isinstance(database_engine, Sqlite3Engine):
|
||||||
return " & ".join(result + "*" for result in results)
|
return " & ".join(result + "*" for result in results)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue