File tree Expand file tree Collapse file tree 2 files changed +24
-12
lines changed Expand file tree Collapse file tree 2 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -496,15 +496,21 @@ async def target():
496496
497497 # Warm the pool with 10 tasks so there are existing connections.
498498 tasks = []
499- for i in range (10 ):
500- tasks .append (asyncio .create_task (target ()))
501- await asyncio .wait (tasks )
499+ for _ in range (10 ):
500+ tasks .append (ConcurrentRunner (target = target ))
501+ for t in tasks :
502+ t .start ()
503+ for t in tasks :
504+ t .join ()
502505
503506 # Run 100 parallel operations that contend for connections.
504507 tasks = []
505- for i in range (100 ):
506- tasks .append (asyncio .create_task (target ()))
507- await asyncio .wait (tasks )
508+ for _ in range (100 ):
509+ tasks .append (ConcurrentRunner (target = target ))
510+ for t in tasks :
511+ t .start ()
512+ for t in tasks :
513+ t .join ()
508514
509515 # Verify there were at least 10 connection checkout failed event but no pool cleared events.
510516 self .assertGreater (len (listener .events_by_type (ConnectionCheckOutFailedEvent )), 10 )
Original file line number Diff line number Diff line change @@ -490,15 +490,21 @@ def target():
490490
491491 # Warm the pool with 10 tasks so there are existing connections.
492492 tasks = []
493- for i in range (10 ):
494- tasks .append (asyncio .create_task (target ()))
495- asyncio .wait (tasks )
493+ for _ in range (10 ):
494+ tasks .append (ConcurrentRunner (target = target ))
495+ for t in tasks :
496+ t .start ()
497+ for t in tasks :
498+ t .join ()
496499
497500 # Run 100 parallel operations that contend for connections.
498501 tasks = []
499- for i in range (100 ):
500- tasks .append (asyncio .create_task (target ()))
501- asyncio .wait (tasks )
502+ for _ in range (100 ):
503+ tasks .append (ConcurrentRunner (target = target ))
504+ for t in tasks :
505+ t .start ()
506+ for t in tasks :
507+ t .join ()
502508
503509 # Verify there were at least 10 connection checkout failed event but no pool cleared events.
504510 self .assertGreater (len (listener .events_by_type (ConnectionCheckOutFailedEvent )), 10 )
You can’t perform that action at this time.
0 commit comments