mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-18 16:02:15 +01:00
Fix bug in util.metrics.Measure
This commit is contained in:
parent
97294ef2fd
commit
241b71852e
1 changed files with 3 additions and 1 deletions
|
@ -63,6 +63,8 @@ class Measure(object):
|
||||||
self.new_context.__enter__()
|
self.new_context.__enter__()
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
current_context = LoggingContext.current_context()
|
||||||
|
|
||||||
self.new_context.__exit__(exc_type, exc_val, exc_tb)
|
self.new_context.__exit__(exc_type, exc_val, exc_tb)
|
||||||
if exc_type is not None:
|
if exc_type is not None:
|
||||||
return
|
return
|
||||||
|
@ -72,7 +74,7 @@ class Measure(object):
|
||||||
|
|
||||||
context = self.new_context
|
context = self.new_context
|
||||||
|
|
||||||
if context != self.start_context:
|
if context != current_context:
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"Context have unexpectedly changed from '%s' to '%s'. (%r)",
|
"Context have unexpectedly changed from '%s' to '%s'. (%r)",
|
||||||
context, self.start_context, self.name
|
context, self.start_context, self.name
|
||||||
|
|
Loading…
Reference in a new issue