@@ -119,6 +119,7 @@ def __init__(
119
119
retry_forever : bool = False ,
120
120
_mock : bool = False ,
121
121
archive_endpoints : Optional [list [str ]] = None ,
122
+ websocket_shutdown_timer : float = 5.0 ,
122
123
):
123
124
"""
124
125
Initializes an instance of the AsyncSubtensor class.
@@ -157,6 +158,7 @@ def __init__(
157
158
retry_forever = retry_forever ,
158
159
_mock = _mock ,
159
160
archive_endpoints = archive_endpoints ,
161
+ ws_shutdown_timer = websocket_shutdown_timer ,
160
162
)
161
163
if self .log_verbose :
162
164
logging .info (
@@ -296,6 +298,7 @@ def _get_substrate(
296
298
retry_forever : bool = False ,
297
299
_mock : bool = False ,
298
300
archive_endpoints : Optional [list [str ]] = None ,
301
+ ws_shutdown_timer : float = 5.0 ,
299
302
) -> Union [AsyncSubstrateInterface , RetryAsyncSubstrate ]:
300
303
"""Creates the Substrate instance based on provided arguments.
301
304
@@ -307,6 +310,8 @@ def _get_substrate(
307
310
archive_endpoints: Similar to fallback_endpoints, but specifically only archive nodes. Will be used in cases
308
311
where you are requesting a block that is too old for your current (presumably lite) node. Defaults to
309
312
`None`
313
+ ws_shutdown_timer: Amount of time, in seconds, to wait after the last response from the chain to close the
314
+ connection.
310
315
311
316
Returns:
312
317
the instance of the SubstrateInterface or RetrySyncSubstrate class.
@@ -322,6 +327,7 @@ def _get_substrate(
322
327
chain_name = "Bittensor" ,
323
328
_mock = _mock ,
324
329
archive_nodes = archive_endpoints ,
330
+ ws_shutdown_timer = ws_shutdown_timer ,
325
331
)
326
332
return AsyncSubstrateInterface (
327
333
url = self .chain_endpoint ,
@@ -330,6 +336,7 @@ def _get_substrate(
330
336
use_remote_preset = True ,
331
337
chain_name = "Bittensor" ,
332
338
_mock = _mock ,
339
+ ws_shutdown_timer = ws_shutdown_timer ,
333
340
)
334
341
335
342
# Subtensor queries ===========================================================================================
0 commit comments