summary refs log tree commit diff
path: root/synapse/appservice/api.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-10-27 10:01:23 +0100
committerGitHub <noreply@github.com>2017-10-27 10:01:23 +0100
commit2fd9831f7cefaf772ef3748466ad93621930bfb2 (patch)
treec9397675334ac172f6312b67f76faae9312cea0f /synapse/appservice/api.py
parentspell out need for libxml2 for lxml to work (diff)
parentUpdate room_list.py (diff)
downloadsynapse-2fd9831f7cefaf772ef3748466ad93621930bfb2.tar.xz
Merge pull request #2574 from matrix-org/erikj/room_list_fixes
Add logging and fix log contexts for publicRooms
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r--synapse/appservice/api.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py

index 6893610e71..40c433d7ae 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py
@@ -18,6 +18,7 @@ from synapse.api.constants import ThirdPartyEntityKind from synapse.api.errors import CodeMessageException from synapse.http.client import SimpleHttpClient from synapse.events.utils import serialize_event +from synapse.util.logcontext import preserve_fn, make_deferred_yieldable from synapse.util.caches.response_cache import ResponseCache from synapse.types import ThirdPartyInstanceID @@ -192,9 +193,12 @@ class ApplicationServiceApi(SimpleHttpClient): defer.returnValue(None) key = (service.id, protocol) - return self.protocol_meta_cache.get(key) or ( - self.protocol_meta_cache.set(key, _get()) - ) + result = self.protocol_meta_cache.get(key) + if not result: + result = self.protocol_meta_cache.set( + key, preserve_fn(_get)() + ) + return make_deferred_yieldable(result) @defer.inlineCallbacks def push_bulk(self, service, events, txn_id=None):