summary refs log tree commit diff
path: root/synapse/rest/client/v1/transactions.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2016-11-11 14:54:10 +0000
committerKegan Dougal <kegan@matrix.org>2016-11-11 14:54:10 +0000
commit42c43cfafd3e0471e4e0f6fb05e951290783ba1f (patch)
tree51b952d37d27a7b3f199be67855f29effec13200 /synapse/rest/client/v1/transactions.py
parentUse observable deferreds because they are sane (diff)
downloadsynapse-42c43cfafd3e0471e4e0f6fb05e951290783ba1f.tar.xz
Use ObservableDeferreds instead of Deferreds as they behave as intended
Diffstat (limited to 'synapse/rest/client/v1/transactions.py')
-rw-r--r--synapse/rest/client/v1/transactions.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/synapse/rest/client/v1/transactions.py b/synapse/rest/client/v1/transactions.py
index f5012c5f59..774430458a 100644
--- a/synapse/rest/client/v1/transactions.py
+++ b/synapse/rest/client/v1/transactions.py
@@ -25,32 +25,32 @@ logger = logging.getLogger(__name__)
 class HttpTransactionCache(object):
 
     def __init__(self):
-        # { key : (txn_id, response_deferred) }
+        # { key : (txn_id, res_observ_defer) }
         self.transactions = {}
 
     def _get_response(self, key, txn_id):
         try:
-            (last_txn_id, response_deferred) = self.transactions[key]
+            (last_txn_id, res_observ_defer) = self.transactions[key]
             if txn_id == last_txn_id:
                 logger.info("get_response: Returning a response for %s", txn_id)
-                return response_deferred
+                return res_observ_defer
         except KeyError:
             pass
         return None
 
-    def _store_response(self, key, txn_id, response_deferred):
-        self.transactions[key] = (txn_id, response_deferred)
+    def _store_response(self, key, txn_id, res_observ_defer):
+        self.transactions[key] = (txn_id, res_observ_defer)
 
-    def store_client_transaction(self, request, txn_id, response_deferred):
+    def store_client_transaction(self, request, txn_id, res_observ_defer):
         """Stores the request/Promise<response> pair of an HTTP transaction.
 
         Args:
             request (twisted.web.http.Request): The twisted HTTP request. This
             request must have the transaction ID as the last path segment.
-            response_deferred (Promise<tuple>): A tuple of (response code, response dict)
+            res_observ_defer (Promise<tuple>): A tuple of (response code, response dict)
             txn_id (str): The transaction ID for this request.
         """
-        self._store_response(self._get_key(request), txn_id, response_deferred)
+        self._store_response(self._get_key(request), txn_id, res_observ_defer)
 
     def get_client_transaction(self, request, txn_id):
         """Retrieves a stored response if there was one.
@@ -64,10 +64,10 @@ class HttpTransactionCache(object):
         Raises:
             KeyError if the transaction was not found.
         """
-        response_deferred = self._get_response(self._get_key(request), txn_id)
-        if response_deferred is None:
+        res_observ_defer = self._get_response(self._get_key(request), txn_id)
+        if res_observ_defer is None:
             raise KeyError("Transaction not found.")
-        return response_deferred
+        return res_observ_defer
 
     def _get_key(self, request):
         token = get_access_token_from_request(request)