summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]setup.py2
-rw-r--r--synapse/handlers/_base.py2
-rw-r--r--synapse/notifier.py6
-rw-r--r--tests/handlers/test_federation.py3
-rw-r--r--tests/handlers/test_room.py5
5 files changed, 11 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index f01eec436f..59ac4fbf94 100644..100755
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 # Copyright 2014 matrix.org
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index 85a0f5dff5..f141e92ce2 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -44,7 +44,7 @@ class BaseRoomHandler(BaseHandler):
         )))
         event.destinations = list(destinations)
 
-        self.notifier.on_new_room_event(event, extra_users=[])
+        self.notifier.on_new_room_event(event, extra_users=extra_users)
 
         federation_handler = self.hs.get_handlers().federation_handler
         yield federation_handler.handle_new_event(event, snapshot)
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 1656717cd7..3d3fcdabdb 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -178,9 +178,13 @@ class Notifier(object):
         if timeout:
             reactor.callLater(timeout/1000, self._timeout_listener, listener)
 
-        self._register_with_keys(listener)
+            self._register_with_keys(listener)
+
         yield self._check_for_updates(listener)
 
+        if not timeout:
+            self._timeout_listener(listener)
+
         return
 
     def _timeout_listener(self, listener):
diff --git a/tests/handlers/test_federation.py b/tests/handlers/test_federation.py
index 5ad40e484c..bc260c8aab 100644
--- a/tests/handlers/test_federation.py
+++ b/tests/handlers/test_federation.py
@@ -77,8 +77,7 @@ class FederationTestCase(unittest.TestCase):
         yield self.handlers.federation_handler.on_receive_pdu(pdu, False)
 
         self.datastore.persist_event.assert_called_once_with(ANY, False)
-        self.notifier.on_new_room_event.assert_called_once_with(
-                ANY, store_id)
+        self.notifier.on_new_room_event.assert_called_once_with(ANY)
 
     @defer.inlineCallbacks
     def test_invite_join_target_this(self):
diff --git a/tests/handlers/test_room.py b/tests/handlers/test_room.py
index a84dbcc471..09d2a92e16 100644
--- a/tests/handlers/test_room.py
+++ b/tests/handlers/test_room.py
@@ -128,9 +128,8 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
             event
         )
         self.notifier.on_new_room_event.assert_called_once_with(
-            event, store_id
+            event, extra_users=[self.hs.parse_userid(target_user_id)]
         )
-
         self.assertFalse(self.datastore.get_room.called)
         self.assertFalse(self.datastore.store_room.called)
         self.assertFalse(self.federation.get_state_for_room.called)
@@ -193,7 +192,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
             event
         )
         self.notifier.on_new_room_event.assert_called_once_with(
-                event, store_id)
+                event, extra_users=[user])
 
         join_signal_observer.assert_called_with(
                 user=user, room_id=room_id)