Rollback if an on_commit action fails.
This commit is contained in:
parent
ede7734a81
commit
8944755dc4
1 changed files with 7 additions and 1 deletions
|
@ -996,7 +996,13 @@ class PDBSQLMixin:
|
||||||
continue
|
continue
|
||||||
args = task.get('args', [])
|
args = task.get('args', [])
|
||||||
kwargs = task.get('kwargs', {})
|
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.savepoints.clear()
|
||||||
self.sql.commit()
|
self.sql.commit()
|
||||||
|
|
Loading…
Reference in a new issue