File tree 1 file changed +8
-5
lines changed 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):
76
76
log .info (f'connected to: { self ._endpoint } ' )
77
77
78
78
async def close (self ):
79
- self ._run_forever_flag = False
80
79
if self ._ws :
81
80
await self ._ws .close ()
82
81
self ._ws = None
83
82
self ._running = False
83
+ self ._run_forever_flag = False
84
84
85
85
async def stop_ws (self ):
86
86
self ._stop_stream_queue .put_nowait ({"should_stop" : True })
@@ -467,11 +467,11 @@ async def _run_forever(self):
467
467
await asyncio .sleep (0.01 )
468
468
469
469
async def close (self ):
470
- self ._run_forever_flag = False
471
470
if self ._ws :
472
471
await self ._ws .close ()
473
472
self ._ws = None
474
473
self ._running = False
474
+ self ._run_forever_flag = False
475
475
476
476
async def stop_ws (self ):
477
477
self ._stop_stream_queue .put_nowait ({"should_stop" : True })
@@ -655,9 +655,12 @@ def run(self):
655
655
pass
656
656
657
657
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
+ )
661
664
662
665
def close (self ):
663
666
loop = asyncio .get_event_loop ()
You can’t perform that action at this time.
0 commit comments