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)