Stop reading from event_edges.room_id. (#12914)

event_edges.room_id is implied by the event id, so there is no need to join on the room id.
This commit is contained in:
Richard van der Hoff 2022-05-31 13:51:49 +01:00 committed by GitHub
parent 1e453053cb
commit 5e17922ef7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 28 deletions

View file

@ -1318,17 +1318,14 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas
query = (
"SELECT prev_event_id FROM event_edges "
"WHERE room_id = ? AND event_id = ? AND is_state = ? "
"WHERE event_id = ? AND NOT is_state "
"LIMIT ?"
)
while front and len(event_results) < limit:
new_front = set()
for event_id in front:
txn.execute(
query, (room_id, event_id, False, limit - len(event_results))
)
txn.execute(query, (event_id, limit - len(event_results)))
new_results = {t[0] for t in txn} - seen_events
new_front |= new_results