Skip to content

Commit 8c76333

Browse files
committed
chore: move close node to network
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent 3c8cd2a commit 8c76333

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/hiero_sdk_python/client/client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,7 @@ def close(self) -> None:
220220
Closes any open gRPC channels and frees resources.
221221
Call this when you are done using the Client to ensure a clean shutdown.
222222
"""
223-
self.network.close_mirror_connection()
224-
225-
# Fix: Close all consensus node channels
226-
if self.network and self.network.nodes:
227-
for node in self.network.nodes:
228-
node._close()
223+
self.network._close()
229224

230225
def set_transport_security(self, enabled: bool) -> Client:
231226
"""

src/hiero_sdk_python/client/network.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,18 @@ def _mark_node_healthy(self, node: _Node) -> None:
429429
if node not in self._healthy_nodes:
430430
self._healthy_nodes.append(node)
431431

432-
def close_mirror_connection(self):
432+
def _close(self):
433433
"""Safely closes the mirror gRPC channel."""
434434
if self._mirror_channel is not None:
435435
self._mirror_channel.close()
436436

437437
self._mirror_channel = None
438438
self._mirror_stub = None
439439

440+
if self.nodes:
441+
for node in self.nodes:
442+
node._close()
443+
440444
def get_mirror_stub(self) -> mirror_consensus_grpc.ConsensusServiceStub:
441445
"""Returns the mirror stub."""
442446
if self._mirror_stub is None:

0 commit comments

Comments
 (0)