(start_idx, retries=20)
| 185 | ) |
| 186 | |
| 187 | def upsert_with_retry(start_idx, retries=20): |
| 188 | for attempt in range(retries): |
| 189 | try: |
| 190 | upsert_in_transaction( |
| 191 | constants["COLLECTION_NAME"], |
| 192 | txn_id, |
| 193 | vectors[start_idx : start_idx + batch_size], |
| 194 | ) |
| 195 | return |
| 196 | except Exception as e: |
| 197 | print( |
| 198 | f"Upsert attempt {attempt + 1} failed for batch starting at index {start_idx}: {e}" |
| 199 | ) |
| 200 | time.sleep(random.uniform(1, 3)) |
| 201 | print( |
| 202 | f"Failed to upsert batch starting at index {start_idx} after {retries} attempts" |
| 203 | ) |
| 204 | |
| 205 | transaction = create_transaction(constants["COLLECTION_NAME"]) |
| 206 | txn_id = transaction["transaction_id"] |
nothing calls this directly
no test coverage detected