From f40c8ee304df6d4ef862238e0cfd8b530cd345aa Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Tue, 18 Feb 2025 16:35:31 +0200 Subject: [PATCH] Closes the connection on the object being garbage-collected. --- async_substrate_interface/sync_substrate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/async_substrate_interface/sync_substrate.py b/async_substrate_interface/sync_substrate.py index 8bb5211..f6cb4e1 100644 --- a/async_substrate_interface/sync_substrate.py +++ b/async_substrate_interface/sync_substrate.py @@ -525,6 +525,9 @@ def __enter__(self): self.initialize() return self + def __del__(self): + self.close() + def initialize(self): """ Initialize the connection to the chain.