瀏覽代碼

Only abort Measure on Exceptions

Erik Johnston 7 年之前
父節點
當前提交
8731197e54
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      synapse/util/metrics.py

+ 1 - 1
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