Stop preserve_fn leaking context into the reactor

Fix a bug in ``logcontext.preserve_fn`` which made it leak context into the
reactor, and add a test for it.

Also, get rid of ``logcontext.reset_context_after_deferred``, which tried to do
the same thing but had its own, different, set of bugs.
This commit is contained in:
Richard van der Hoff 2017-03-17 20:56:54 +00:00
parent 067b00d49d
commit f40c2db05a
3 changed files with 93 additions and 34 deletions

View file

@ -933,8 +933,9 @@ class FederationHandler(BaseHandler):
# lots of requests for missing prev_events which we do actually
# have. Hence we fire off the deferred, but don't wait for it.
synapse.util.logcontext.reset_context_after_deferred(
self._handle_queued_pdus(room_queue))
synapse.util.logcontext.preserve_fn(self._handle_queued_pdus)(
room_queue
)
defer.returnValue(True)