summary refs log tree commit diff
path: root/synapse/app/synchrotron.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-03-21 13:11:15 +0000
committerGitHub <noreply@github.com>2017-03-21 13:11:15 +0000
commit37a187bfabdd6d39630a04739e822d0d1fa7daea (patch)
tree7372b8cb70c6ae240e4465363607338df3d76c96 /synapse/app/synchrotron.py
parentMerge pull request #2035 from matrix-org/rav/debug_federation (diff)
parentFix unit test (diff)
downloadsynapse-37a187bfabdd6d39630a04739e822d0d1fa7daea.tar.xz
Merge pull request #2033 from matrix-org/erikj/repl_speed
Don't send the full event json over replication
Diffstat (limited to 'synapse/app/synchrotron.py')
-rw-r--r--synapse/app/synchrotron.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py
index a68bb873fe..34e34e5580 100644
--- a/synapse/app/synchrotron.py
+++ b/synapse/app/synchrotron.py
@@ -20,7 +20,6 @@ from synapse.api.constants import EventTypes, PresenceState
 from synapse.config._base import ConfigError
 from synapse.config.homeserver import HomeServerConfig
 from synapse.config.logger import setup_logging
-from synapse.events import FrozenEvent
 from synapse.handlers.presence import PresenceHandler
 from synapse.http.site import SynapseSite
 from synapse.http.server import JsonResource
@@ -411,11 +410,16 @@ class SynchrotronServer(HomeServer):
             stream = result.get("events")
             if stream:
                 max_position = stream["position"]
+
+                event_map = yield store.get_events([row[1] for row in stream["rows"]])
+
                 for row in stream["rows"]:
                     position = row[0]
-                    internal = json.loads(row[1])
-                    event_json = json.loads(row[2])
-                    event = FrozenEvent(event_json, internal_metadata_dict=internal)
+                    event_id = row[1]
+                    event = event_map.get(event_id, None)
+                    if not event:
+                        continue
+
                     extra_users = ()
                     if event.type == EventTypes.Member:
                         extra_users = (event.state_key,)