()
| 107 | |
| 108 | # Run hello until we have connected to each host at least once. |
| 109 | async def discover(): |
| 110 | i = 0 |
| 111 | while i < 100 and connected_host_list != target_host_list: |
| 112 | hello: dict = await client.admin.command( |
| 113 | HelloCompat.LEGACY_CMD, read_preference=ReadPreference.SECONDARY |
| 114 | ) |
| 115 | connected_host_list.update([hello["me"]]) |
| 116 | i += 1 |
| 117 | return connected_host_list |
| 118 | |
| 119 | try: |
| 120 |