From: Michael Tremer Date: Sat, 25 Jan 2025 17:51:06 +0000 (+0000) Subject: database: Add a helper function to trigger a commit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a3ce0dcc3de1ec5391f5464f398e57b0ce38816;p=pbs.git database: Add a helper function to trigger a commit Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/database.py b/src/buildservice/database.py index ecd6741c..9ae9ad58 100644 --- a/src/buildservice/database.py +++ b/src/buildservice/database.py @@ -412,6 +412,16 @@ class Connection(object): # Otherwise return the attribute only return getattr(result, attr) + async def commit(self): + """ + Manually triggers a database commit + """ + # Fetch our session + session = await self.session() + + # Commit! + await session.commit() + class BackendMixin: @functools.cached_property