Skip to content

Commit 2386f8f

Browse files
Uxio0lorks
authored andcommitted
Close http session when EthereumClient is garbage collected
1 parent 5fe180f commit 2386f8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

safe_eth/eth/ethereum_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,10 @@ def __init__(
12721272
def __str__(self):
12731273
return f"EthereumClient for url={self.ethereum_node_url}"
12741274

1275+
def __del__(self):
1276+
if getattr(self, "http_session", None):
1277+
self.http_session.close()
1278+
12751279
def raw_batch_request(
12761280
self, payload: Sequence[Dict[str, Any]], batch_size: Optional[int] = None
12771281
) -> Iterable[Union[Optional[Dict[str, Any]], List[Dict[str, Any]]]]:

0 commit comments

Comments
 (0)