Change the way we do logging contexts so that they survive divergences

This commit is contained in:
Erik Johnston 2015-05-08 16:32:18 +01:00
parent db0dca2f6f
commit 476899295f
13 changed files with 128 additions and 97 deletions

View file

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.util.logcontext import LoggingContext
from synapse.util.logcontext import LoggingContext, PreserveLoggingContext
from twisted.internet import defer, reactor, task
@ -50,8 +50,10 @@ class Clock(object):
current_context = LoggingContext.current_context()
def wrapped_callback():
LoggingContext.thread_local.current_context = current_context
callback()
with PreserveLoggingContext():
LoggingContext.thread_local.current_context = current_context
callback()
return reactor.callLater(delay, wrapped_callback)
def cancel_call_later(self, timer):