From: Michael Tremer Date: Wed, 22 Jan 2025 12:47:52 +0000 (+0000) Subject: builders: Fetch the builder again on message X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ceb96e81748cc19c48233982c928b5f3ce74b253;p=pbs.git builders: Fetch the builder again on message This is necessary because this will be launched in a new task. Since we cannot use the object from a different session, we have to fetch the builder again. Signed-off-by: Michael Tremer --- diff --git a/src/web/builders.py b/src/web/builders.py index 5cbb149d..25d9b6c1 100644 --- a/src/web/builders.py +++ b/src/web/builders.py @@ -33,6 +33,10 @@ class APIv1ControlHandler(base.APIMixin, base.BackendMixin, tornado.websocket.We self.builder.disconnected() async def on_message(self, message): + # Fetch the builder again, because this is being executed as a separate task + # and therefore we cannot use the object from the previous session. + builder = await self.backend.builders.get_by_name(self.builder.name) + # Decode message message = self._decode_json_message(message)