feat: remove multiple pinecone client inits from startup (#6128)

feat: remove multiple pinecone client inits
This commit is contained in:
cthomas
2025-11-12 07:58:58 -08:00
committed by Caren Thomas
parent 0c06dbf047
commit 209debeb09

View File

@@ -151,8 +151,9 @@ async def upsert_pinecone_indices():
indices = get_pinecone_indices()
logger.info(f"[Pinecone] Upserting {len(indices)} indices: {indices}")
for index_name in indices:
async with PineconeAsyncio(api_key=settings.pinecone_api_key) as pc:
# Reuse single client for all indices to avoid creating multiple SSL contexts
async with PineconeAsyncio(api_key=settings.pinecone_api_key) as pc:
for index_name in indices:
if not await pc.has_index(index_name):
logger.info(f"[Pinecone] Creating index {index_name} with model {PINECONE_EMBEDDING_MODEL}")
await pc.create_index_for_model(