(thread_id)
| 392 | cache.insert_cache("model", [i], [f"original_{i}"]) |
| 393 | |
| 394 | def fetch_and_verify(thread_id): |
| 395 | try: |
| 396 | for _ in range(50): |
| 397 | token_id = thread_id % 20 |
| 398 | result, remaining = cache.fetch_nearest_cache("model", [token_id]) |
| 399 | |
| 400 | if result is not None: |
| 401 | # Verify data integrity |
| 402 | expected_prefix = f"original_{token_id}" |
| 403 | if not str(result[0]).startswith("original_"): |
| 404 | with lock: |
| 405 | errors.append(f"Corrupted data: {result}") |
| 406 | |
| 407 | # Re-insert to keep cache populated |
| 408 | cache.insert_cache("model", [token_id], result) |
| 409 | |
| 410 | except Exception as e: |
| 411 | with lock: |
| 412 | errors.append(str(e)) |
| 413 | |
| 414 | with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: |
| 415 | futures = [executor.submit(fetch_and_verify, tid) for tid in range(10)] |
nothing calls this directly
no test coverage detected