diff options
author | Kegan Dougal <kegan@matrix.org> | 2016-11-14 09:52:41 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2016-11-14 09:52:41 +0000 |
commit | af4a1bac5088e8083f55eea05f6fad44208a3a51 (patch) | |
tree | 0b4f692fc20917a0621b82a27473c67f7cd860cd /synapse/rest/client/transactions.py | |
parent | Review comments (diff) | |
download | synapse-af4a1bac5088e8083f55eea05f6fad44208a3a51.tar.xz |
Move .observe() up to the cache to make things neater
Diffstat (limited to 'synapse/rest/client/transactions.py')
-rw-r--r-- | synapse/rest/client/transactions.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/rest/client/transactions.py b/synapse/rest/client/transactions.py index 1db972a378..8d69e12d36 100644 --- a/synapse/rest/client/transactions.py +++ b/synapse/rest/client/transactions.py @@ -67,19 +67,18 @@ class HttpTransactionCache(object): txn_key (str): A key to ensure idempotency should fetch_or_execute be called again at a later point in time. fn (function): A function which returns a tuple of - (response_code, response_dict)d + (response_code, response_dict). *args: Arguments to pass to fn. **kwargs: Keyword arguments to pass to fn. Returns: - synapse.util.async.ObservableDeferred which resolves to a tuple - of (response_code, response_dict). + Deferred which resolves to a tuple of (response_code, response_dict). """ try: - return self.transactions[txn_key] + return self.transactions[txn_key].observe() except KeyError: pass # execute the function instead. deferred = fn(*args, **kwargs) observable = ObservableDeferred(deferred) self.transactions[txn_key] = observable - return observable + return observable.observe() |