summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-11-23 14:09:47 +0000
committerErik Johnston <erik@matrix.org>2016-11-23 14:09:47 +0000
commit26072df6af7ca37b8e6e5f340a00e695de5c93d5 (patch)
tree2abd7451b4b1ffbef5f8e899f1fed7272e89c193 /synapse/notifier.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/split_out_... (diff)
downloadsynapse-26072df6af7ca37b8e6e5f340a00e695de5c93d5.tar.xz
Ensure only main or federation_sender process can send federation traffic
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index d528d1c1e0..054ca59ad2 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -143,7 +143,12 @@ class Notifier(object):
 
         self.clock = hs.get_clock()
         self.appservice_handler = hs.get_application_service_handler()
-        self.federation_sender = hs.get_federation_sender()
+
+        if hs.should_send_federation():
+            self.federation_sender = hs.get_federation_sender()
+        else:
+            self.federation_sender = None
+
         self.state_handler = hs.get_state_handler()
 
         self.clock.looping_call(
@@ -220,7 +225,9 @@ class Notifier(object):
         """Notify any user streams that are interested in this room event"""
         # poke any interested application service.
         self.appservice_handler.notify_interested_services(room_stream_id)
-        self.federation_sender.notify_new_events(room_stream_id)
+
+        if self.federation_sender:
+            self.federation_sender.notify_new_events(room_stream_id)
 
         if event.type == EventTypes.Member and event.membership == Membership.JOIN:
             self._user_joined_room(event.state_key, event.room_id)