(sixm,
idx_name: str,
min_count: int,
retries: Optional[int] = 20,
delay: Optional[int] = 30
)
| 34 | |
| 35 | |
| 36 | def check_doc_count(sixm, |
| 37 | idx_name: str, |
| 38 | min_count: int, |
| 39 | retries: Optional[int] = 20, |
| 40 | delay: Optional[int] = 30 |
| 41 | ) -> bool: |
| 42 | |
| 43 | indexed_docs = 0 |
| 44 | no_docs_cutoff = 300 |
| 45 | for i in range(retries): |
| 46 | # if no docs after waiting for a period of time, exit |
| 47 | if indexed_docs == 0 and i * delay >= no_docs_cutoff: |
| 48 | return 0 |
| 49 | indexed_docs = sixm.get_indexed_documents_count(idx_name) |
| 50 | if indexed_docs >= min_count: |
| 51 | break |
| 52 | print(f'Found {indexed_docs} indexed docs, waiting a bit...') |
| 53 | sleep(delay) |
| 54 | |
| 55 | return indexed_docs |
| 56 | |
| 57 | |
| 58 | def load_search_idx(cluster: Cluster) -> None: |
no test coverage detected