Fix missing session rollback on commit error

This commit is contained in:
Ozzieisaacs
2020-12-07 19:53:34 +01:00
parent f13522559d
commit 5e3618716d
8 changed files with 208 additions and 62 deletions

View File

@@ -322,8 +322,11 @@ def delete_shelf_helper(cur_shelf):
g.ubsession.delete(cur_shelf)
g.ubsession.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id).delete()
g.ubsession.add(ub.ShelfArchive(uuid=cur_shelf.uuid, user_id=cur_shelf.user_id))
g.ubsession.commit()
log.info("successfully deleted %s", cur_shelf)
try:
g.ubsession.commit()
log.info("successfully deleted %s", cur_shelf)
except OperationalError:
g.ubsession.rollback()