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