From 05d60be1efe19c5bedeb27cff2ba72e6ed2903c2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 27 Mar 2025 10:46:01 +0000 Subject: [PATCH] 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 --- src/buildservice/builders.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.47.3