summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-02 13:02:33 +0100
committerErik Johnston <erik@matrix.org>2016-06-03 11:24:16 +0100
commit4c04222fa55d35ad3a75c5538ec477046b6c5b30 (patch)
tree295fc1e717979b0c302348f15cad98c0dddddea3 /synapse/handlers/message.py
parentMerge pull request #811 from matrix-org/erikj/state_users_in_room (diff)
downloadsynapse-4c04222fa55d35ad3a75c5538ec477046b6c5b30.tar.xz
Poke notifier on next reactor tick
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index c41dafdef5..15caf1950a 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -26,9 +26,9 @@ from synapse.types import (
     UserID, RoomAlias, RoomStreamToken, StreamToken, get_domain_from_id
 )
 from synapse.util import unwrapFirstError
-from synapse.util.async import concurrently_execute
+from synapse.util.async import concurrently_execute, run_on_reactor
 from synapse.util.caches.snapshot_cache import SnapshotCache
-from synapse.util.logcontext import PreserveLoggingContext, preserve_fn
+from synapse.util.logcontext import preserve_fn
 from synapse.visibility import filter_events_for_client
 
 from ._base import BaseHandler
@@ -908,13 +908,16 @@ class MessageHandler(BaseHandler):
                     "Failed to get destination from event %s", s.event_id
                 )
 
-        with PreserveLoggingContext():
-            # Don't block waiting on waking up all the listeners.
+        @defer.inlineCallbacks
+        def _notify():
+            yield run_on_reactor()
             self.notifier.on_new_room_event(
                 event, event_stream_id, max_stream_id,
                 extra_users=extra_users
             )
 
+        preserve_fn(_notify)()
+
         # If invite, remove room_state from unsigned before sending.
         event.unsigned.pop("invite_room_state", None)