From 8731197e54f4f004f19f87fd5fa5b4ed7ad5b8be Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 19 Aug 2016 18:13:07 +0100 Subject: [PATCH] Only abort Measure on Exceptions --- synapse/util/metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py index 76f301f54..4ea930d3e 100644 --- a/synapse/util/metrics.py +++ b/synapse/util/metrics.py @@ -87,7 +87,7 @@ class Measure(object): self.db_txn_duration = self.start_context.db_txn_duration def __exit__(self, exc_type, exc_val, exc_tb): - if exc_type is not None or not self.start_context: + if isinstance(exc_type, Exception) or not self.start_context: return duration = self.clock.time_msec() - self.start