Convenience to wait for a newly-constructed client to connect.
(client)
| 1284 | |
| 1285 | |
| 1286 | def connected(client): |
| 1287 | """Convenience to wait for a newly-constructed client to connect.""" |
| 1288 | with warnings.catch_warnings(): |
| 1289 | # Ignore warning that ping is always routed to primary even |
| 1290 | # if client's read preference isn't PRIMARY. |
| 1291 | warnings.simplefilter("ignore", UserWarning) |
| 1292 | client.admin.command("ping") # Force connection. |
| 1293 | |
| 1294 | return client |
| 1295 | |
| 1296 | |
| 1297 | def drop_collections(db: Database): |