diff options
author | Erik Johnston <erik@matrix.org> | 2016-06-02 13:02:33 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-06-02 13:03:34 +0100 |
commit | 6de4d824e3e6106269e281a53ed006956db1ad0f (patch) | |
tree | 94ac43c19c1a4c022d3b139ab10400a8a2376e0a | |
parent | Make get_joined_hosts_for_room use get_users_in_room (diff) | |
download | synapse-6de4d824e3e6106269e281a53ed006956db1ad0f.tar.xz |
Poke notifier on next reactor tick
-rw-r--r-- | synapse/handlers/message.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 90c614c9ef..fc7e87de8f 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.util.logutils import log_duration from synapse.visibility import filter_events_for_client @@ -913,13 +913,16 @@ class MessageHandler(BaseHandler): "Failed to get destination from event %s", s.event_id ) + @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 + ) + with log_duration("on_new_room_event"): - with PreserveLoggingContext(): - # Don't block waiting on waking up all the listeners. - 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) |