async-revised
All checks were successful
Deploy on push / deploy (push) Successful in 5s

This commit is contained in:
2024-11-02 00:26:57 +03:00
parent 54c59d26b9
commit 0c009495a3
6 changed files with 91 additions and 55 deletions

View File

@@ -166,7 +166,19 @@ class SearchService:
async def perform_index(self, shout, index_body):
if self.client:
self.client.index(index=self.index_name, id=str(shout.id), body=index_body)
try:
await asyncio.wait_for(
self.client.index(
index=self.index_name,
id=str(shout.id),
body=index_body
),
timeout=40.0
)
except asyncio.TimeoutError:
logger.error(f"Indexing timeout for shout {shout.id}")
except Exception as e:
logger.error(f"Indexing error for shout {shout.id}: {e}")
async def search(self, text, limit, offset):
logger.info(f"Ищем: {text} {offset}+{limit}")