summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2016-11-11 14:13:32 +0000
committerKegan Dougal <kegan@matrix.org>2016-11-11 14:13:32 +0000
commitc7daf3136c8ae024187cd50530d3ee90b1385b13 (patch)
treeb281aae32dca667f34a83b20af8053e43481b27b /synapse/rest
parentFlake8 (diff)
downloadsynapse-c7daf3136c8ae024187cd50530d3ee90b1385b13.tar.xz
Use observable deferreds because they are sane
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/sendtodevice.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/sendtodevice.py b/synapse/rest/client/v2_alpha/sendtodevice.py
index 4d13e793ac..31167ba535 100644
--- a/synapse/rest/client/v2_alpha/sendtodevice.py
+++ b/synapse/rest/client/v2_alpha/sendtodevice.py
@@ -20,6 +20,7 @@ from twisted.internet import defer
 from synapse.http import servlet
 from synapse.http.servlet import parse_json_object_from_request
 from synapse.rest.client.v1.transactions import HttpTransactionCache
+from synapse.util.async import ObservableDeferred
 
 from ._base import client_v2_patterns
 
@@ -47,14 +48,14 @@ class SendToDeviceRestServlet(servlet.RestServlet):
     def on_PUT(self, request, message_type, txn_id):
         try:
             res_deferred = self.txns.get_client_transaction(request, txn_id)
-            res = yield res_deferred
+            res = yield res_deferred.observe()
             defer.returnValue(res)
         except KeyError:
             pass
 
-        res_deferred = self._put(request, message_type, txn_id)
+        res_deferred = ObservableDeferred(self._put(request, message_type, txn_id))
         self.txns.store_client_transaction(request, txn_id, res_deferred)
-        res = yield res_deferred
+        res = yield res_deferred.observe()
         defer.returnValue(res)
 
     @defer.inlineCallbacks