Skip to content
Snippets Groups Projects
Unverified Commit f76d407e authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Fix dropped logcontexts during high outbound traffic. (#5277)

Fixes #5271.
parent 7ddbbc45
No related branches found
No related tags found
No related merge requests found
Fix dropped logcontexts during high outbound traffic.
...@@ -344,15 +344,21 @@ class _LimitedHostnameResolver(object): ...@@ -344,15 +344,21 @@ class _LimitedHostnameResolver(object):
def resolveHostName(self, resolutionReceiver, hostName, portNumber=0, def resolveHostName(self, resolutionReceiver, hostName, portNumber=0,
addressTypes=None, transportSemantics='TCP'): addressTypes=None, transportSemantics='TCP'):
# Note this is happening deep within the reactor, so we don't need to
# worry about log contexts.
# We need this function to return `resolutionReceiver` so we do all the # We need this function to return `resolutionReceiver` so we do all the
# actual logic involving deferreds in a separate function. # actual logic involving deferreds in a separate function.
self._resolve(
resolutionReceiver, hostName, portNumber, # even though this is happening within the depths of twisted, we need to drop
addressTypes, transportSemantics, # our logcontext before starting _resolve, otherwise: (a) _resolve will drop
) # the logcontext if it returns an incomplete deferred; (b) _resolve will
# call the resolutionReceiver *with* a logcontext, which it won't be expecting.
with PreserveLoggingContext():
self._resolve(
resolutionReceiver,
hostName,
portNumber,
addressTypes,
transportSemantics,
)
return resolutionReceiver return resolutionReceiver
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment