From: Michael Tremer Date: Fri, 7 Feb 2025 15:48:37 +0000 (+0000) Subject: builders: Fix the watchers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e630488856a5a69d53f1dfaa9e31ba1c7e9302d;p=pbs.git builders: Fix the watchers Signed-off-by: Michael Tremer --- diff --git a/src/web/builds.py b/src/web/builds.py index 6b3991fe..5fe0f9f1 100644 --- a/src/web/builds.py +++ b/src/web/builds.py @@ -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)