From a01e1e27b101335da546836f105121cca5de716c Mon Sep 17 00:00:00 2001 From: cdw8431 Date: Sat, 5 Aug 2023 19:45:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(node):=20=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?=EB=85=B8=EB=93=9C=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EB=B9=84?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94=20=EB=85=B8=EB=93=9C=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=20=ED=95=B4=EC=A3=BC=EB=8A=94=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/domain/node/repository.py | 6 ------ app/domain/node/service.py | 5 ----- 2 files changed, 11 deletions(-) diff --git a/app/domain/node/repository.py b/app/domain/node/repository.py index 46a2100..974bb43 100644 --- a/app/domain/node/repository.py +++ b/app/domain/node/repository.py @@ -10,9 +10,6 @@ async def is_active(self, node_id: str) -> bool: async def get_all_nodes(self) -> list[str]: raise NotImplementedError - async def delete_node(self, node_id: str) -> None: - raise NotImplementedError - class NodeRedisRepository(NodeRepository): _NODE_SERVERS_KEY = "node_servers" @@ -25,6 +22,3 @@ async def is_active(self, node_id: str) -> bool: async def get_all_nodes(self) -> list[str]: return await self._session.hkeys(self._NODE_SERVERS_KEY) - - async def delete_node(self, node_id: str) -> None: - await self._session.hdel(self._NODE_SERVERS_KEY, node_id) diff --git a/app/domain/node/service.py b/app/domain/node/service.py index 8062ea1..cdb73c4 100644 --- a/app/domain/node/service.py +++ b/app/domain/node/service.py @@ -8,9 +8,4 @@ def __init__(self, node_repo: NodeRepository): async def get_active_nodes(self) -> list[str]: all_nodes: set[str] = set(await self._node_repo.get_all_nodes()) active_nodes: set[str] = {node for node in all_nodes if await self._node_repo.is_active(node)} - - should_delete_nodes = all_nodes - active_nodes - for node in should_delete_nodes: - await self._node_repo.delete_node(node) - return list(active_nodes)