mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 10:13:53 +01:00
Reduce to-device queries for /sync. (#12163)
This commit is contained in:
parent
75574726a7
commit
0752ab7a36
2 changed files with 4 additions and 0 deletions
1
changelog.d/12163.misc
Normal file
1
changelog.d/12163.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Reduce number of DB queries made during processing of `/sync`.
|
|
@ -298,6 +298,9 @@ class DeviceInboxWorkerStore(SQLBaseStore):
|
||||||
# This user has new messages sent to them. Query messages for them
|
# This user has new messages sent to them. Query messages for them
|
||||||
user_ids_to_query.add(user_id)
|
user_ids_to_query.add(user_id)
|
||||||
|
|
||||||
|
if not user_ids_to_query:
|
||||||
|
return {}, to_stream_id
|
||||||
|
|
||||||
def get_device_messages_txn(txn: LoggingTransaction):
|
def get_device_messages_txn(txn: LoggingTransaction):
|
||||||
# Build a query to select messages from any of the given devices that
|
# Build a query to select messages from any of the given devices that
|
||||||
# are between the given stream id bounds.
|
# are between the given stream id bounds.
|
||||||
|
|
Loading…
Reference in a new issue