summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-14 11:58:45 +0100
committerErik Johnston <erik@matrix.org>2019-05-14 13:12:23 +0100
commita80e6b53f903d75b053546db5d99c93bffc4495e (patch)
treebbb4c8845a99dafda9e3784936d18adbbb55e0c4
parentAllow client event serialization to be async (diff)
downloadsynapse-a80e6b53f903d75b053546db5d99c93bffc4495e.tar.xz
Newsfile
-rw-r--r--changelog.d/5183.misc1
-rw-r--r--synapse/rest/client/v2_alpha/sync.py12
2 files changed, 7 insertions, 6 deletions
diff --git a/changelog.d/5183.misc b/changelog.d/5183.misc
new file mode 100644
index 0000000000..a8970f29eb
--- /dev/null
+++ b/changelog.d/5183.misc
@@ -0,0 +1 @@
+Allow client event serialization to be async.
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index 078d65969a..c701e534e7 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -200,7 +200,7 @@ class SyncRestServlet(RestServlet):
             event_formatter,
         )
 
-        return {
+        defer.returnValue({
             "account_data": {"events": sync_result.account_data},
             "to_device": {"events": sync_result.to_device},
             "device_lists": {
@@ -222,7 +222,7 @@ class SyncRestServlet(RestServlet):
             },
             "device_one_time_keys_count": sync_result.device_one_time_keys_count,
             "next_batch": sync_result.next_batch.to_string(),
-        }
+        })
 
     @staticmethod
     def encode_presence(events, time_now):
@@ -266,7 +266,7 @@ class SyncRestServlet(RestServlet):
                 event_formatter=event_formatter,
             )
 
-        return joined
+        defer.returnValue(joined)
 
     @defer.inlineCallbacks
     def encode_invited(self, rooms, time_now, token_id, event_formatter):
@@ -302,7 +302,7 @@ class SyncRestServlet(RestServlet):
                 "invite_state": {"events": invited_state}
             }
 
-        return invited
+        defer.returnValue(invited)
 
     @defer.inlineCallbacks
     def encode_archived(self, rooms, time_now, token_id, event_fields, event_formatter):
@@ -332,7 +332,7 @@ class SyncRestServlet(RestServlet):
                 event_formatter=event_formatter,
             )
 
-        return joined
+        defer.returnValue(joined)
 
     @defer.inlineCallbacks
     def encode_room(
@@ -398,7 +398,7 @@ class SyncRestServlet(RestServlet):
             result["unread_notifications"] = room.unread_notifications
             result["summary"] = room.summary
 
-        return result
+        defer.returnValue(result)
 
 
 def register_servlets(hs, http_server):