summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-03-15 17:41:06 +0000
committerMark Haines <mark.haines@matrix.org>2016-03-15 17:42:03 +0000
commit12904932c41c73714543b817157f09073fcc2625 (patch)
tree052efa995df2f96cd1aae693025cdfc1195a8129 /synapse
parentAdd replication stream for pushers (diff)
downloadsynapse-12904932c41c73714543b817157f09073fcc2625.tar.xz
Hook up adding a pusher to the notifier for replication.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/notifier.py6
-rw-r--r--synapse/rest/client/v1/pusher.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 9b69b0333a..f00cd8c588 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -282,6 +282,12 @@ class Notifier(object):
 
             self.notify_replication()
 
+    def on_new_replication_data(self):
+        """Used to inform replication listeners that something has happend
+        without waking up any of the normal user event streams"""
+        with PreserveLoggingContext():
+            self.notify_replication()
+
     @defer.inlineCallbacks
     def wait_for_events(self, user_id, timeout, callback, room_ids=None,
                         from_token=StreamToken.START):
diff --git a/synapse/rest/client/v1/pusher.py b/synapse/rest/client/v1/pusher.py
index ee029b4f77..9881f068c3 100644
--- a/synapse/rest/client/v1/pusher.py
+++ b/synapse/rest/client/v1/pusher.py
@@ -29,6 +29,10 @@ logger = logging.getLogger(__name__)
 class PusherRestServlet(ClientV1RestServlet):
     PATTERNS = client_path_patterns("/pushers/set$")
 
+    def __init__(self, hs):
+        super(PusherRestServlet, self).__init__(hs)
+        self.notifier = hs.get_notifier()
+
     @defer.inlineCallbacks
     def on_POST(self, request):
         requester = yield self.auth.get_user_by_req(request)
@@ -87,6 +91,8 @@ class PusherRestServlet(ClientV1RestServlet):
             raise SynapseError(400, "Config Error: " + pce.message,
                                errcode=Codes.MISSING_PARAM)
 
+        self.notifier.on_new_replication_data()
+
         defer.returnValue((200, {}))
 
     def on_OPTIONS(self, _):