Make rollback conditional on db.dirty

avoids calling rollback when there are no changes

includes warning about what objects are actually dirty
This commit is contained in:
Min RK
2017-07-24 12:53:58 +02:00
parent 1229fd100f
commit ce53b11cf7

View File

@@ -94,6 +94,8 @@ class BaseHandler(RequestHandler):
def finish(self, *args, **kwargs): def finish(self, *args, **kwargs):
"""Roll back any uncommitted transactions from the handler.""" """Roll back any uncommitted transactions from the handler."""
if self.db.dirty:
self.log.warning("Rolling back dirty objects %s", self.db.dirty)
self.db.rollback() self.db.rollback()
super().finish(*args, **kwargs) super().finish(*args, **kwargs)