summary refs log tree commit diff
path: root/synapse/crypto/keyclient.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-10-30 01:21:33 +0000
committerMark Haines <mark.haines@matrix.org>2014-10-30 01:21:33 +0000
commitb29517bd013b82302b1a73072da8bfc39564dc1a (patch)
tree363ac928a18f2432b6d53c27dde2f2efb34b16a8 /synapse/crypto/keyclient.py
parentfix mobile CSS layout (diff)
downloadsynapse-b29517bd013b82302b1a73072da8bfc39564dc1a.tar.xz
Add a request-id to each log line
Diffstat (limited to 'synapse/crypto/keyclient.py')
-rw-r--r--synapse/crypto/keyclient.py10
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)