In get_state_groups, get the full event json rather than just the event_ids so we don't have to do so many db queries
parent
d3d0713de5
commit
33d2d82f6d
|
@ -60,14 +60,19 @@ class StateStore(SQLBaseStore):
|
|||
|
||||
res = {}
|
||||
for group in groups:
|
||||
state_ids = self._simple_select_onecol_txn(
|
||||
txn,
|
||||
table="state_groups_state",
|
||||
keyvalues={"state_group": group},
|
||||
retcol="event_id",
|
||||
sql = (
|
||||
"SELECT internal_metadata, json, r.event_id "
|
||||
"FROM event_json as e "
|
||||
"INNER JOIN state_groups_state as s "
|
||||
"ON e.event_id = s.event_id "
|
||||
"LEFT JOIN redactions as r ON e.event_id = r.redacts "
|
||||
"WHERE s.state_group = ?"
|
||||
)
|
||||
|
||||
state = self._get_events_txn(txn, state_ids)
|
||||
txn.execute(sql, (group,))
|
||||
rows = txn.fetchall()
|
||||
|
||||
state = [self._get_event_from_row_txn(txn, *r) for r in rows]
|
||||
|
||||
res[group] = state
|
||||
|
||||
|
|
Loading…
Reference in New Issue