diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-30 01:21:33 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-30 01:21:33 +0000 |
commit | b29517bd013b82302b1a73072da8bfc39564dc1a (patch) | |
tree | 363ac928a18f2432b6d53c27dde2f2efb34b16a8 /synapse/crypto | |
parent | fix mobile CSS layout (diff) | |
download | synapse-b29517bd013b82302b1a73072da8bfc39564dc1a.tar.xz |
Add a request-id to each log line
Diffstat (limited to 'synapse/crypto')
-rw-r--r-- | synapse/crypto/keyclient.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/crypto/keyclient.py b/synapse/crypto/keyclient.py index 7cfec5148e..33fa9ca837 100644 --- a/synapse/crypto/keyclient.py +++ b/synapse/crypto/keyclient.py @@ -18,6 +18,7 @@ from twisted.web.http import HTTPClient from twisted.internet.protocol import Factory from twisted.internet import defer, reactor from synapse.http.endpoint import matrix_endpoint +from synapse.util.logcontext import PreserveLoggingContext import json import logging @@ -36,10 +37,11 @@ def fetch_server_key(server_name, ssl_context_factory): for i in range(5): try: - protocol = yield endpoint.connect(factory) - server_response, server_certificate = yield protocol.remote_key - defer.returnValue((server_response, server_certificate)) - return + with PreserveLoggingContext(): + protocol = yield endpoint.connect(factory) + server_response, server_certificate = yield protocol.remote_key + defer.returnValue((server_response, server_certificate)) + return except Exception as e: logger.exception(e) raise IOError("Cannot get key for %s" % server_name) |