From: Michael Tremer Date: Sun, 26 Jan 2025 17:27:35 +0000 (+0000) Subject: jobs: Store control connections by their UUID X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d95e18d3d4fcb99f7d39247d6fc81006eec6aa43;p=pbs.git jobs: Store control connections by their UUID Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 69ed8229..cbc14e63 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -699,10 +699,10 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin): # Close the previous connection self.connection.close(code=1000, reason="Replaced by a new connection") - log.debug("Connection opened for %s by %s" % (self, connection.builder)) + log.debug("Connection opened for %s" % self) # Store the connection - self.backend.jobs.connections[self] = connection + self.backend.jobs.connections[self.uuid] = connection def disconnected(self): """ @@ -711,7 +711,7 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin): log.debug("%s has disconnected" % self) try: - del self.backend.jobs.connections[self] + del self.backend.jobs.connections[self.uuid] except IndexError: pass @@ -721,7 +721,7 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin): Easy access to the control connection to a builder """ try: - return self.backend.jobs.connections[self] + return self.backend.jobs.connections[self.uuid] except KeyError: pass