* fix: abort transactions in response to any unhandled exception, no
transactions must be left dangling
This commit is contained in:
@@ -63,6 +63,9 @@ def txn_proc(proc, txn = None):
|
|||||||
except db.DBError, e:
|
except db.DBError, e:
|
||||||
autotxn.abort()
|
autotxn.abort()
|
||||||
raise e
|
raise e
|
||||||
|
except Exception, e:
|
||||||
|
autotxn.abort()
|
||||||
|
raise e
|
||||||
autotxn.commit()
|
autotxn.commit()
|
||||||
else:
|
else:
|
||||||
retval = proc(None)
|
retval = proc(None)
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ class DBShelf:
|
|||||||
except db.DBError, e:
|
except db.DBError, e:
|
||||||
autotxn.abort()
|
autotxn.abort()
|
||||||
raise e
|
raise e
|
||||||
|
except Exception, e:
|
||||||
|
autotxn.abort()
|
||||||
|
raise e
|
||||||
autotxn.commit()
|
autotxn.commit()
|
||||||
else: # execute without transactions
|
else: # execute without transactions
|
||||||
retval = proc(None)
|
retval = proc(None)
|
||||||
|
|||||||
Reference in New Issue
Block a user