Fix logcontexts

This commit is contained in:
Erik Johnston 2019-08-23 15:05:56 +01:00
parent 1e4b4d85e7
commit e70f0081da

View File

@ -28,7 +28,7 @@ from twisted.web.iweb import IAgent, IAgentEndpointFactory
from synapse.http.federation.srv_resolver import Server, SrvResolver from synapse.http.federation.srv_resolver import Server, SrvResolver
from synapse.http.federation.well_known_resolver import WellKnownResolver from synapse.http.federation.well_known_resolver import WellKnownResolver
from synapse.logging.context import PreserveLoggingContext, make_deferred_yieldable from synapse.logging.context import make_deferred_yieldable, run_in_background
from synapse.util import Clock from synapse.util import Clock
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -158,8 +158,9 @@ class MatrixFederationAgent(object):
if not headers.hasHeader(b"host"): if not headers.hasHeader(b"host"):
headers.addRawHeader(b"host", parsed_uri.netloc) headers.addRawHeader(b"host", parsed_uri.netloc)
with PreserveLoggingContext(): res = yield make_deferred_yieldable(
res = yield self._agent.request(method, uri, headers, bodyProducer) self._agent.request(method, uri, headers, bodyProducer)
)
return res return res
@ -214,11 +215,14 @@ class MatrixHostnameEndpoint(object):
self._srv_resolver = srv_resolver self._srv_resolver = srv_resolver
@defer.inlineCallbacks
def connect(self, protocol_factory): def connect(self, protocol_factory):
"""Implements IStreamClientEndpoint interface """Implements IStreamClientEndpoint interface
""" """
return run_in_background(self._do_connect, protocol_factory)
@defer.inlineCallbacks
def _do_connect(self, protocol_factory):
first_exception = None first_exception = None
server_list = yield self._resolve_server() server_list = yield self._resolve_server()