File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -615,18 +615,22 @@ async def async_ensure_all_connected(client: AsyncMongoClient) -> None:
615
615
connected_host_list = {hello ["me" ]}
616
616
617
617
# Run hello until we have connected to each host at least once.
618
- def discover ():
618
+ async def discover ():
619
619
i = 0
620
620
while i < 100 and connected_host_list != target_host_list :
621
- hello : dict = client .admin .command (
621
+ hello : dict = await client .admin .command (
622
622
HelloCompat .LEGACY_CMD , read_preference = ReadPreference .SECONDARY
623
623
)
624
624
connected_host_list .update ([hello ["me" ]])
625
625
i += 1
626
626
return connected_host_list
627
627
628
628
try :
629
- await async_wait_until (lambda : target_host_list == discover (), "connected to all hosts" )
629
+
630
+ async def predicate ():
631
+ return target_host_list == await discover ()
632
+
633
+ await async_wait_until (predicate , "connected to all hosts" )
630
634
except AssertionError as exc :
631
635
raise AssertionError (
632
636
f"{ exc } , { connected_host_list } != { target_host_list } , { client .topology_description } "
You can’t perform that action at this time.
0 commit comments