summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-03-18 13:15:45 -0400
committerGitHub <noreply@github.com>2022-03-18 17:15:45 +0000
commit80e0e1f35e6b1cdfa0267f9c40a6f212b7d774de (patch)
treebfb55bc6a8891539e9cb0bbc54d8fa230f2513dd /synapse/storage
parentSync more worker regexes in the documentation. (#12243) (diff)
downloadsynapse-80e0e1f35e6b1cdfa0267f9c40a6f212b7d774de.tar.xz
Only fetch thread participation for events with threads. (#12228)
We fetch the thread summary in two phases:

1. The summary that is shared by all users (count of messages and latest event).
2. Whether the requesting user has participated in the thread.

There's no use in attempting step 2 for events which did not return a summary
from step 1.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/relations.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/relations.py b/synapse/storage/databases/main/relations.py
index c4869d64e6..af2334a65e 100644
--- a/synapse/storage/databases/main/relations.py
+++ b/synapse/storage/databases/main/relations.py
@@ -857,7 +857,9 @@ class RelationsWorkerStore(SQLBaseStore):
         summaries = await self._get_thread_summaries(events_by_id.keys())
         # Only fetch participated for a limited selection based on what had
         # summaries.
-        participated = await self._get_threads_participated(summaries.keys(), user_id)
+        participated = await self._get_threads_participated(
+            [event_id for event_id, summary in summaries.items() if summary], user_id
+        )
         for event_id, summary in summaries.items():
             if summary:
                 thread_count, latest_thread_event, edit = summary