0.2.21-ga

This commit is contained in:
2024-01-23 16:04:38 +03:00
parent 954e6dabb7
commit 3f65652a5f
9 changed files with 249 additions and 209 deletions

View File

@@ -23,7 +23,6 @@ class SearchService:
try:
# TODO: add ttl for redis cached search results
cached = await redis.execute("GET", text)
if not cached:
async with SearchService.lock:
# Use aiohttp to send a request to ElasticSearch
@@ -35,7 +34,7 @@ class SearchService:
await redis.execute("SET", text, json.dumps(payload)) # use redis as cache
else:
logging.error(f"[services.search] response: {response.status} {await response.text()}")
else:
elif isinstance(cached, str):
payload = json.loads(cached)
except Exception as e:
logging.error(f"[services.search] Error during search: {e}")