summary refs log tree commit diff
path: root/synapse/replication
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-03-01 11:20:07 +0000
committerGitHub <noreply@github.com>2018-03-01 11:20:07 +0000
commit182ff17c8322c770eb001b3a0a3194a89df464e1 (patch)
tree1cccf81ea8935305ef6cac5da0e9677ebb832f42 /synapse/replication
parentMerge pull request #2913 from matrix-org/erikj/store_push (diff)
parentCheck event auth on the worker (diff)
downloadsynapse-182ff17c8322c770eb001b3a0a3194a89df464e1.tar.xz
Merge pull request #2875 from matrix-org/erikj/push_actions_worker
Calculate push actions on worker
Diffstat (limited to 'synapse/replication')
-rw-r--r--synapse/replication/http/send_event.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/replication/http/send_event.py b/synapse/replication/http/send_event.py
index 468f4b68f4..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()
 
@@ -106,8 +116,10 @@ class ReplicationSendEventRestServlet(RestServlet):
             event.event_id, event.room_id,
         )
 
-        yield self.event_creation_handler.handle_new_client_event(
+        yield self.event_creation_handler.persist_and_notify_client_event(
             requester, event, context,
+            ratelimit=ratelimit,
+            extra_users=extra_users,
         )
 
         defer.returnValue((200, {}))