Add Rollback function to Trade

simplifies Session work
This commit is contained in:
Matthias
2022-08-06 15:08:13 +02:00
parent 45d68222a1
commit 5250189f77
5 changed files with 10 additions and 5 deletions

View File

@@ -18,9 +18,9 @@ def get_rpc_optional() -> Optional[RPC]:
def get_rpc() -> Optional[Iterator[RPC]]:
_rpc = get_rpc_optional()
if _rpc:
Trade.query.session.rollback()
Trade.rollback()
yield _rpc
Trade.query.session.rollback()
Trade.rollback()
else:
raise RPCException('Bot is not in the correct state')