From 8845f931df487c4c6e76b33564c2e5232ff034ce Mon Sep 17 00:00:00 2001 From: krateng Date: Mon, 25 Apr 2022 21:50:40 +0200 Subject: [PATCH] Wrapped DB write operations in transactions to ensure integrity --- maloja/database/sqldb.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maloja/database/sqldb.py b/maloja/database/sqldb.py index dcda72f..5d6b620 100644 --- a/maloja/database/sqldb.py +++ b/maloja/database/sqldb.py @@ -115,8 +115,9 @@ def connection_provider(func): return func(*args,**kwargs) else: with engine.connect() as connection: - kwargs['dbconn'] = connection - return func(*args,**kwargs) + with connection.begin(): + kwargs['dbconn'] = connection + return func(*args,**kwargs) wrapper.__innerfunc__ = func return wrapper