summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-08-24 15:53:07 +0100
committerGitHub <noreply@github.com>2023-08-24 14:53:07 +0000
commite691243e191d9dad2bcbf55f9659d007f75fd28e (patch)
tree91db17d2145140077779b4532094b6a464479ba3 /synapse/handlers/message.py
parentAdd `Retry-After` to M_LIMIT_EXCEEDED error responses (#16136) (diff)
downloadsynapse-e691243e191d9dad2bcbf55f9659d007f75fd28e.tar.xz
Fix typechecking with twisted trunk (#16121)
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index a74db1dccf..3184bfb047 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -1474,23 +1474,23 @@ class EventCreationHandler:
 
         # We now persist the event (and update the cache in parallel, since we
         # don't want to block on it).
-        event, context = events_and_context[0]
+        #
+        # Note: mypy gets confused if we inline dl and check with twisted#11770.
+        # Some kind of bug in mypy's deduction?
+        deferreds = (
+            run_in_background(
+                self._persist_events,
+                requester=requester,
+                events_and_context=events_and_context,
+                ratelimit=ratelimit,
+                extra_users=extra_users,
+            ),
+            run_in_background(
+                self.cache_joined_hosts_for_events, events_and_context
+            ).addErrback(log_failure, "cache_joined_hosts_for_event failed"),
+        )
         result, _ = await make_deferred_yieldable(
-            gather_results(
-                (
-                    run_in_background(
-                        self._persist_events,
-                        requester=requester,
-                        events_and_context=events_and_context,
-                        ratelimit=ratelimit,
-                        extra_users=extra_users,
-                    ),
-                    run_in_background(
-                        self.cache_joined_hosts_for_events, events_and_context
-                    ).addErrback(log_failure, "cache_joined_hosts_for_event failed"),
-                ),
-                consumeErrors=True,
-            )
+            gather_results(deferreds, consumeErrors=True)
         ).addErrback(unwrapFirstError)
 
         return result