From 3057c0ef570d360819624beedbf6dde847dfb2be Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Wed, 26 Feb 2025 14:41:46 -0600 Subject: [PATCH] fix: connection reuse with multi-tenancy (#3543) Signed-off-by: Daniel Bluhm --- acapy_agent/core/profile.py | 15 +++++++++++++++ acapy_agent/protocols/out_of_band/v1_0/routes.py | 1 + 2 files changed, 16 insertions(+) diff --git a/acapy_agent/core/profile.py b/acapy_agent/core/profile.py index 65e7b4ee76..8c52e419fe 100644 --- a/acapy_agent/core/profile.py +++ b/acapy_agent/core/profile.py @@ -130,6 +130,21 @@ def __repr__(self) -> str: self.__class__.__name__, self.backend, self.name ) + def __eq__(self, other) -> bool: + """Equality checks for profiles. + + Multiple profile instances can exist at the same time but point to the + same profile. This allows us to test equality based on the profile + pointed to by the instance rather than by object reference comparison. + """ + if not isinstance(other, Profile): + return False + + if type(self) is not type(other): + return False + + return self.name == other.name + class ProfileManager(ABC): """Handle provision and open for profile instances.""" diff --git a/acapy_agent/protocols/out_of_band/v1_0/routes.py b/acapy_agent/protocols/out_of_band/v1_0/routes.py index f600e8b808..ced2c6694b 100644 --- a/acapy_agent/protocols/out_of_band/v1_0/routes.py +++ b/acapy_agent/protocols/out_of_band/v1_0/routes.py @@ -328,6 +328,7 @@ async def invitation_receive(request: web.BaseRequest): mediation_id=mediation_id, ) except (DIDXManagerError, StorageError, BaseModelError) as err: + LOGGER.exception("Error during receive invitation") raise web.HTTPBadRequest(reason=err.roll_up) from err return web.json_response(result.serialize())