File tree Expand file tree Collapse file tree 1 file changed +21
-12
lines changed
Expand file tree Collapse file tree 1 file changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -61,19 +61,28 @@ async def op(
6161 ) as worker :
6262 await create_nexus_endpoint (worker .task_queue , client )
6363
64- coros = [
65- client .execute_workflow (
66- NexusCallerWorkflow .run ,
67- i ,
68- id = str (uuid .uuid4 ()),
69- task_queue = worker .task_queue ,
64+ tasks = [
65+ asyncio .create_task (
66+ client .execute_workflow (
67+ NexusCallerWorkflow .run ,
68+ i ,
69+ id = str (uuid .uuid4 ()),
70+ task_queue = worker .task_queue ,
71+ )
7072 )
7173 for i in range (num_nexus_operations )
7274 ]
73- try :
74- await asyncio . wait_for ( asyncio . gather ( * coros ), timeout = 5 )
75- except asyncio . TimeoutError :
76- pass
77- event . set ( )
78- assert len ( set ( ids )) == len ( ids )
75+
76+ for _ in range ( 50 ): # 5 seconds max
77+ if len ( ids ) >= expected_num_executed :
78+ break
79+ await asyncio . sleep ( 0.1 )
80+
7981 assert len (ids ) == expected_num_executed
82+ assert len (set (ids )) == len (ids )
83+
84+ event .set ()
85+ for task in tasks :
86+ if not task .done ():
87+ task .cancel ()
88+ await asyncio .gather (* tasks , return_exceptions = True )
You can’t perform that action at this time.
0 commit comments