]> git.ipfire.org Git - pbs.git/commitdiff
builders: Fix the watchers
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 7 Feb 2025 15:48:37 +0000 (15:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 7 Feb 2025 15:48:37 +0000 (15:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/builds.py

index 6b3991fe8f7d90e87b92ad375c418f6489d186c1..5fe0f9f1c0e6d5e5375f27c66d9ea105e52712e0 100644 (file)
@@ -195,26 +195,26 @@ class DeleteHandler(base.BaseHandler):
 
 class WatchHandler(base.BaseHandler):
        @base.authenticated
-       def post(self, uuid):
-               build = self.backend.builds.get_by_uuid(uuid)
+       async def post(self, uuid):
+               build = await self.backend.builds.get_by_uuid(uuid)
                if not build:
                        raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
 
-               with self.db.transaction():
-                       build.add_watcher(self.current_user)
+               # Add the watcher
+               await build.add_watcher(self.current_user)
 
                self.redirect("/builds/%s" % build.uuid)
 
 
 class UnwatchHandler(base.BaseHandler):
        @base.authenticated
-       def post(self, uuid):
-               build = self.backend.builds.get_by_uuid(uuid)
+       async def post(self, uuid):
+               build = await self.backend.builds.get_by_uuid(uuid)
                if not build:
                        raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
 
-               with self.db.transaction():
-                       build.remove_watcher(self.current_user)
+               # Remove the watcher
+               await build.remove_watcher(self.current_user)
 
                self.redirect("/builds/%s" % build.uuid)