mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Fix remote receipts for events we don't have (#17096)
Introduced in #17032
This commit is contained in:
parent
c8e0bed426
commit
803f05f60c
1
changelog.d/17096.misc
Normal file
1
changelog.d/17096.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Use new receipts column to optimise receipt and push action SQL queries. Contributed by Nick @ Beeper (@fizzadar).
|
@ -734,9 +734,13 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
|||||||
thread_clause = "r.thread_id = ?"
|
thread_clause = "r.thread_id = ?"
|
||||||
thread_args = (thread_id,)
|
thread_args = (thread_id,)
|
||||||
|
|
||||||
|
# If the receipt doesn't have a stream ordering it is because we
|
||||||
|
# don't have the associated event, and so must be a remote receipt.
|
||||||
|
# Hence it's safe to just allow new receipts to clobber it.
|
||||||
sql = f"""
|
sql = f"""
|
||||||
SELECT r.event_stream_ordering, r.event_id FROM receipts_linearized AS r
|
SELECT r.event_stream_ordering, r.event_id FROM receipts_linearized AS r
|
||||||
WHERE r.room_id = ? AND r.receipt_type = ? AND r.user_id = ? AND {thread_clause}
|
WHERE r.room_id = ? AND r.receipt_type = ? AND r.user_id = ?
|
||||||
|
AND r.event_stream_ordering IS NOT NULL AND {thread_clause}
|
||||||
"""
|
"""
|
||||||
txn.execute(
|
txn.execute(
|
||||||
sql,
|
sql,
|
||||||
|
Loading…
Reference in New Issue
Block a user