summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-06-24 18:48:18 +0100
committerGitHub <noreply@github.com>2020-06-24 18:48:18 +0100
commit0e0a2817a29391fd777f7ee683dc03d63cf40302 (patch)
tree21897195e00b33db69bb0c220d9c6d2896bea9ce /synapse/handlers
parentadd org.matrix.login.jwt so that m.login.jwt can be deprecated (#7675) (diff)
downloadsynapse-0e0a2817a29391fd777f7ee683dc03d63cf40302.tar.xz
Yield during large v2 state res. (#7735)
State res v2 across large data sets can be very CPU intensive, and if
all the relevant events are in the cache the algorithm will run from
start to finish within a single reactor tick. This can result in
blocking the reactor tick for several seconds, which can have major
repercussions on other requests.

To fix this we simply add the occaisonal `sleep(0)` during iterations to
yield execution until the next reactor tick. The aim is to only do this
for large data sets so that we don't impact otherwise quick resolutions.=
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/federation.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 873f6bc39f..3828ff0ef0 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -376,6 +376,7 @@ class FederationHandler(BaseHandler):
 
                     room_version = await self.store.get_room_version_id(room_id)
                     state_map = await resolve_events_with_store(
+                        self.clock,
                         room_id,
                         room_version,
                         state_maps,