fmt
All checks were successful
Deploy on push / deploy (push) Successful in 22s

This commit is contained in:
2024-03-28 15:56:32 +03:00
parent 7f913050ee
commit 9bda7cef95
12 changed files with 273 additions and 177 deletions

View File

@@ -122,7 +122,9 @@ class SearchService:
async def recreate_index(self):
if self.client:
async with self.lock:
self.client.indices.delete(index=self.index_name, ignore_unavailable=True)
self.client.indices.delete(
index=self.index_name, ignore_unavailable=True
)
await self.check_index()
def index(self, shout):
@@ -146,7 +148,12 @@ class SearchService:
# Use Redis as cache with TTL
redis_key = f'search:{text}'
await redis.execute('SETEX', redis_key, REDIS_TTL, json.dumps(results, cls=CustomJSONEncoder))
await redis.execute(
'SETEX',
redis_key,
REDIS_TTL,
json.dumps(results, cls=CustomJSONEncoder),
)
return []