Skip to content

Commit

Permalink
Also use node in the map keys for uniqueness wrt node
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Dec 17, 2024
1 parent 6b5de72 commit 6ab29a3
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ class SingletonServiceCaller:
_clients = {}

def __new__(cls, node, service_type, fully_qualified_service_name):
if fully_qualified_service_name not in cls._clients:
cls._clients[fully_qualified_service_name] = node.create_client(
if (node, fully_qualified_service_name) not in cls._clients:
cls._clients[(node, fully_qualified_service_name)] = node.create_client(
service_type, fully_qualified_service_name
)
node.get_logger().debug(
f"{bcolors.MAGENTA}Creating a new service client : {fully_qualified_service_name}{bcolors.ENDC}"
f"{bcolors.MAGENTA}Creating a new service client : {fully_qualified_service_name} with node : {node.get_name()}{bcolors.ENDC}"
)

node.get_logger().debug(
f"{bcolors.OKBLUE}Returning the existing service client : {fully_qualified_service_name}{bcolors.ENDC}"
f"{bcolors.OKBLUE}Returning the existing service client : {fully_qualified_service_name} for node : {node.get_name()}{bcolors.ENDC}"
)
return cls._clients[fully_qualified_service_name]
return cls._clients[(node, fully_qualified_service_name)]


def service_caller(
Expand Down

0 comments on commit 6ab29a3

Please sign in to comment.