@@ -180,66 +180,6 @@ async def test_query_map_with_odd_number_of_params():
180180 assert len (first_record [0 ]) == 4
181181
182182
183- @pytest .mark .asyncio
184- async def test_improved_reconnection_ ():
185- ws_logger_path = "/tmp/websockets-proxy-test"
186- ws_logger = logging .getLogger ("websockets.proxy" )
187- if os .path .exists (ws_logger_path ):
188- os .remove (ws_logger_path )
189- ws_logger .setLevel (logging .INFO )
190- ws_logger .addHandler (logging .FileHandler (ws_logger_path ))
191-
192- asi_logger_path = "/tmp/async-substrate-interface-test"
193- if os .path .exists (asi_logger_path ):
194- os .remove (asi_logger_path )
195- logger .setLevel (logging .DEBUG )
196- logger .addHandler (logging .FileHandler (asi_logger_path ))
197-
198- proxy = ProxyServer ("wss://archive.sub.latent.to" , 10 , 20 )
199- proxy .connect ()
200- server_thread = threading .Thread (target = proxy .serve )
201- server_thread .daemon = True
202- server_thread .start ()
203-
204- await asyncio .sleep (3 ) # give the server start up time
205-
206- try :
207- async with AsyncSubstrateInterface (
208- "ws://localhost:8080" ,
209- ss58_format = 42 ,
210- chain_name = "Bittensor" ,
211- retry_timeout = 10.0 ,
212- ws_shutdown_timer = None ,
213- ) as substrate :
214- blocks_to_check = [
215- 5215000 ,
216- 5215001 ,
217- 5215002 ,
218- 5215003 ,
219- 5215004 ,
220- 5215005 ,
221- 5215006 ,
222- ]
223- tasks = []
224- for block in blocks_to_check :
225- block_hash = await substrate .get_block_hash (block_id = block )
226- tasks .append (
227- substrate .query_map (
228- "SubtensorModule" , "TotalHotkeyShares" , block_hash = block_hash
229- )
230- )
231- records = await asyncio .gather (* tasks )
232- assert len (records ) == len (blocks_to_check )
233- await substrate .close ()
234- with open (ws_logger_path , "r" ) as f :
235- assert "Pausing" in f .read ()
236- with open (asi_logger_path , "r" ) as f :
237- assert "Timeout/ConnectionClosed occurred." in f .read ()
238- finally :
239- proxy .stop ()
240- server_thread .join (timeout = 5 )
241-
242-
243183@pytest .mark .asyncio
244184async def test_improved_reconnection ():
245185 ws_logger_path = "/tmp/websockets-proxy-test"
0 commit comments