File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -349,16 +349,23 @@ def _on_exception(loop, context):
349349
350350 # If there is an event in the queue, create a task to process it
351351 # and add it to the list of awaitables
352+ process_one_event_task = None
352353 if not self .__context ._event_queue .empty ():
353354 process_one_event_task = this_loop .create_task (self ._process_one_event ())
354355 entity_futures .append (process_one_event_task )
355356
356357 if len (entity_futures ) > 0 :
357- done , pending = await asyncio .wait (
358- entity_futures ,
359- timeout = 1.0 ,
360- return_when = asyncio .FIRST_COMPLETED
361- )
358+ while True :
359+ done , pending = await asyncio .wait (
360+ entity_futures ,
361+ timeout = 1.0 ,
362+ return_when = asyncio .FIRST_COMPLETED
363+ )
364+ if process_one_event_task is not None :
365+ if process_one_event_task in done :
366+ break
367+ elif done :
368+ break
362369
363370 except KeyboardInterrupt :
364371 continue
You can’t perform that action at this time.
0 commit comments