Skip to content

Commit 71db62f

Browse files
committed
Eliminate timeout
1 parent 79a71eb commit 71db62f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

tests/nexus/test_worker.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)