summary refs log tree commit diff
path: root/synapse/replication
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-03-01 10:08:28 +0000
committerErik Johnston <erik@matrix.org>2018-03-01 10:08:39 +0000
commit6b8604239f4c9463023e59664e7810ba58b8f428 (patch)
treedf9c598bc2d2d8e54fdeffc7b7bf7545358ff5d2 /synapse/replication
parentFixup comments (diff)
downloadsynapse-6b8604239f4c9463023e59664e7810ba58b8f428.tar.xz
Correctly send ratelimit and extra_users params
Diffstat (limited to 'synapse/replication')
-rw-r--r--synapse/replication/http/send_event.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/synapse/replication/http/send_event.py b/synapse/replication/http/send_event.py
index 3a99a88bc5..439bfbb4f6 100644
--- a/synapse/replication/http/send_event.py
+++ b/synapse/replication/http/send_event.py
@@ -29,7 +29,8 @@ logger = logging.getLogger(__name__)
 
 
 @defer.inlineCallbacks
-def send_event_to_master(client, host, port, requester, event, context):
+def send_event_to_master(client, host, port, requester, event, context,
+                         ratelimit, extra_users):
     """Send event to be handled on the master
 
     Args:
@@ -39,6 +40,8 @@ def send_event_to_master(client, host, port, requester, event, context):
         requester (Requester)
         event (FrozenEvent)
         context (EventContext)
+        ratelimit (bool)
+        extra_users (list(str)): Any extra users to notify about event
     """
     uri = "http://%s:%s/_synapse/replication/send_event" % (host, port,)
 
@@ -48,6 +51,8 @@ def send_event_to_master(client, host, port, requester, event, context):
         "rejected_reason": event.rejected_reason,
         "context": context.serialize(event),
         "requester": requester.serialize(),
+        "ratelimit": ratelimit,
+        "extra_users": extra_users,
     }
 
     try:
@@ -74,6 +79,8 @@ class ReplicationSendEventRestServlet(RestServlet):
             "rejected_reason": ..,   // The event.rejected_reason field
             "context": { .. serialized event context .. },
             "requester": { .. serialized requester .. },
+            "ratelimit": true,
+            "extra_users": [],
         }
     """
     PATTERNS = [re.compile("^/_synapse/replication/send_event$")]
@@ -98,6 +105,9 @@ class ReplicationSendEventRestServlet(RestServlet):
             requester = Requester.deserialize(self.store, content["requester"])
             context = yield EventContext.deserialize(self.store, content["context"])
 
+            ratelimit = content["ratelimit"]
+            extra_users = content["extra_users"]
+
         if requester.user:
             request.authenticated_entity = requester.user.to_string()
 
@@ -108,6 +118,8 @@ class ReplicationSendEventRestServlet(RestServlet):
 
         yield self.event_creation_handler.persist_and_notify_client_event(
             requester, event, context,
+            ratelimit=ratelimit,
+            extra_users=extra_users,
         )
 
         defer.returnValue((200, {}))