From 59c84d24b269d037a29d6b814d91ff1a6494d2a7 Mon Sep 17 00:00:00 2001 From: Fatima367 <170196704+Fatima367@users.noreply.github.com> Date: Wed, 13 May 2026 21:05:52 +0500 Subject: [PATCH] fix: remove unused imports & replace blocking time.sleep() with async anyio.sleep() in ingest endpoint --- backend/src/api/ingest.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/backend/src/api/ingest.py b/backend/src/api/ingest.py index 8cf7ef7..e4a5de9 100644 --- a/backend/src/api/ingest.py +++ b/backend/src/api/ingest.py @@ -1,10 +1,7 @@ from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field import os -import glob import uuid -import time -from typing import List import anyio from ..services.embedding_service import get_embeddings @@ -143,7 +140,7 @@ async def ingest_docs(): # Wait 60 seconds between batches (except after the last batch) if i + batch_size < len(texts_to_embed): print(f"⏳ Waiting 60 seconds before next batch to avoid rate limits...") - time.sleep(60) + await anyio.sleep(60) print(f"✅ All embeddings generated successfully!")