]> git.ipfire.org Git - pbs.git/commitdiff
database: Add a helper function to trigger a commit
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Jan 2025 17:51:06 +0000 (17:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Jan 2025 17:51:06 +0000 (17:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/database.py

index ecd6741ce354c4985ff6d86e558d90ad942e3651..9ae9ad5877409e300557dcfb1d2e28e8d0912019 100644 (file)
@@ -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