In get_recent_events_for_room, get the full event json rather than just the event_ids so we don't have to do so many db queries
parent
33d2d82f6d
commit
03c0da9f65
|
@ -269,8 +269,11 @@ class StreamStore(SQLBaseStore):
|
||||||
# TODO (erikj): Handle compressed feedback
|
# TODO (erikj): Handle compressed feedback
|
||||||
|
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT stream_ordering, topological_ordering, event_id FROM events "
|
"SELECT stream_ordering, topological_ordering, "
|
||||||
"WHERE room_id = ? AND stream_ordering <= ? AND outlier = 0 "
|
"internal_metadata, json, r.event_id FROM events as e "
|
||||||
|
"LEFT JOIN event_json as ej ON e.event_id = ej.event_id "
|
||||||
|
"LEFT JOIN redactions as r ON e.event_id = r.redacts "
|
||||||
|
"WHERE e.room_id = ? AND stream_ordering <= ? AND outlier = 0 "
|
||||||
"ORDER BY topological_ordering DESC, stream_ordering DESC LIMIT ? "
|
"ORDER BY topological_ordering DESC, stream_ordering DESC LIMIT ? "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -295,11 +298,15 @@ class StreamStore(SQLBaseStore):
|
||||||
else:
|
else:
|
||||||
token = (end_token, end_token)
|
token = (end_token, end_token)
|
||||||
|
|
||||||
events = self._get_events_txn(
|
events = [
|
||||||
|
self._get_event_from_row_txn(
|
||||||
txn,
|
txn,
|
||||||
[r["event_id"] for r in rows],
|
r["internal_metadata"],
|
||||||
get_prev_content=True
|
r["json"],
|
||||||
|
r["event_id"],
|
||||||
)
|
)
|
||||||
|
for r in rows
|
||||||
|
]
|
||||||
|
|
||||||
return events, token
|
return events, token
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue