From: Michael Tremer Date: Thu, 27 Mar 2025 10:46:01 +0000 (+0000) Subject: builders: Raise BuilderNotOnlineError if the connection does not work X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05d60be1efe19c5bedeb27cff2ba72e6ed2903c2;p=pbs.git builders: Raise BuilderNotOnlineError if the connection does not work In case we have a connection, but it has gone away, we will just pretend that the builder is offline. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builders.py b/src/buildservice/builders.py index 54aedb22..36781aa7 100644 --- a/src/buildservice/builders.py +++ b/src/buildservice/builders.py @@ -924,7 +924,12 @@ class Builder(database.Base, database.BackendMixin, database.SoftDeleteMixin): self, json.dumps(message, indent=4, sort_keys=True)) # Write the message to the control connection - return self.connection.write_message(message) + try: + return self.connection.write_message(message) + + # If the connection broke, we raise BuilderNotOnlineError + except tornado.websocket.WebSocketClosedError as e: + raise BuilderNotOnlineError(self) from e # Uploads