Skip to content
Snippets Groups Projects
Unverified Commit 0752ab7a authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Reduce to-device queries for /sync. (#12163)

parent 75574726
No related branches found
No related tags found
No related merge requests found
Reduce number of DB queries made during processing of `/sync`.
...@@ -298,6 +298,9 @@ class DeviceInboxWorkerStore(SQLBaseStore): ...@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment