File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ async def _process_callbacks_async():
7171 except IndexError :
7272 _log_debug ("Callback queue empty" )
7373 break
74- await asyncio .sleep (0.5 ) # Yield to other tasks
74+ await asyncio .sleep (0.1 ) # Yield to other tasks
7575
7676class WebSocketApp :
7777 def __init__ (
@@ -281,8 +281,10 @@ async def _async_main(self):
281281
282282 # Cleanup
283283 _log_debug ("Initiating cleanup" )
284- _run_callback (self .on_close , self , None , None )
285- await asyncio .sleep (1 ) # wait a bit for _process_callbacks_async to call on_close
284+ #_run_callback(self.on_close, self, None, None)
285+ # await asyncio.sleep(0.1) # need to wait for _process_callbacks_async to call on_close, but how much is enough?
286+ if self .on_close :
287+ self .on_close (self , None , None ) # don't use _run_callback() but do it immediately
286288 self .running = False
287289 callback_task .cancel () # Stop callback task
288290 try :
You can’t perform that action at this time.
0 commit comments