Only abort Measure on Exceptions

This commit is contained in:
Erik Johnston 2016-08-19 18:13:07 +01:00
parent afbf6b33fc
commit 8731197e54

View file

@ -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