File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -76,11 +76,11 @@ async def _start_ws(self):
7676 log .info (f'connected to: { self ._endpoint } ' )
7777
7878 async def close (self ):
79- self ._run_forever_flag = False
8079 if self ._ws :
8180 await self ._ws .close ()
8281 self ._ws = None
8382 self ._running = False
83+ self ._run_forever_flag = False
8484
8585 async def stop_ws (self ):
8686 self ._stop_stream_queue .put_nowait ({"should_stop" : True })
@@ -467,11 +467,11 @@ async def _run_forever(self):
467467 await asyncio .sleep (0.01 )
468468
469469 async def close (self ):
470- self ._run_forever_flag = False
471470 if self ._ws :
472471 await self ._ws .close ()
473472 self ._ws = None
474473 self ._running = False
474+ self ._run_forever_flag = False
475475
476476 async def stop_ws (self ):
477477 self ._stop_stream_queue .put_nowait ({"should_stop" : True })
@@ -655,9 +655,12 @@ def run(self):
655655 pass
656656
657657 async def _close (self ):
658- await self ._trading_ws .close ()
659- await self ._data_ws .close ()
660- await self ._crypto_ws .close ()
658+ await asyncio .gather (
659+ self .stop_ws (),
660+ self ._trading_ws .close (),
661+ self ._data_ws .close (),
662+ self ._crypto_ws .close ()
663+ )
661664
662665 def close (self ):
663666 loop = asyncio .get_event_loop ()
You can’t perform that action at this time.
0 commit comments