summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-15 15:20:29 +0100
committerErik Johnston <erik@matrix.org>2015-05-15 15:20:29 +0100
commit807229f2f2acbdcb471bdfd8458910879d183c63 (patch)
treed07b079f5d7170d40308d216f04afc7bf6dd0d8e /synapse/handlers
parentMake store.get_current_state fetch events asyncly (diff)
downloadsynapse-807229f2f2acbdcb471bdfd8458910879d183c63.tar.xz
Err, defer.gatherResults ftw
Diffstat (limited to '')
-rw-r--r--synapse/handlers/message.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 6a1b25d112..867fdbefb0 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -303,27 +303,18 @@ class MessageHandler(BaseHandler):
             if event.membership != Membership.JOIN:
                 return
             try:
-                # (messages, token), current_state = yield defer.gatherResults(
-                #     [
-                #         self.store.get_recent_events_for_room(
-                #             event.room_id,
-                #             limit=limit,
-                #             end_token=now_token.room_key,
-                #         ),
-                #         self.state_handler.get_current_state(
-                #             event.room_id
-                #         ),
-                #     ]
-                # ).addErrback(unwrapFirstError)
-
-                messages, token = yield self.store.get_recent_events_for_room(
-                    event.room_id,
-                    limit=limit,
-                    end_token=now_token.room_key,
-                )
-                current_state = yield self.state_handler.get_current_state(
-                    event.room_id
-                )
+                (messages, token), current_state = yield defer.gatherResults(
+                    [
+                        self.store.get_recent_events_for_room(
+                            event.room_id,
+                            limit=limit,
+                            end_token=now_token.room_key,
+                        ),
+                        self.state_handler.get_current_state(
+                            event.room_id
+                        ),
+                    ]
+                ).addErrback(unwrapFirstError)
 
                 start_token = now_token.copy_and_replace("room_key", token[0])
                 end_token = now_token.copy_and_replace("room_key", token[1])