Rollback if an on_commit action fails.

This commit is contained in:
voussoir 2021-01-03 00:19:08 -08:00
parent ede7734a81
commit 8944755dc4

View file

@ -996,7 +996,13 @@ class PDBSQLMixin:
continue
args = task.get('args', [])
kwargs = task.get('kwargs', {})
task['action'](*args, **kwargs)
action = task['action']
try:
action(*args, **kwargs)
except Exception as exc:
self.log.debug(f'{action} raised {repr(exc)}.')
self.rollback()
raise
self.savepoints.clear()
self.sql.commit()