This commit is contained in:
parent
8b65c87750
commit
5966512a8f
|
@ -22,11 +22,12 @@ opensearch-py = "^2.6.0"
|
||||||
httpx = "^0.27.0"
|
httpx = "^0.27.0"
|
||||||
dogpile-cache = "^1.3.1"
|
dogpile-cache = "^1.3.1"
|
||||||
colorlog = "^6.8.2"
|
colorlog = "^6.8.2"
|
||||||
|
fakeredis = "^2.25.1"
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
ruff = "^0.4.7"
|
ruff = "^0.4.7"
|
||||||
isort = "^5.13.2"
|
isort = "^5.13.2"
|
||||||
fakeredis = "^2.25.1"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|
|
@ -329,12 +329,11 @@ async def update_reaction(_, info, reaction):
|
||||||
try:
|
try:
|
||||||
reaction_query = query_reactions().filter(Reaction.id == rid)
|
reaction_query = query_reactions().filter(Reaction.id == rid)
|
||||||
reaction_query = add_reaction_stat_columns(reaction_query)
|
reaction_query = add_reaction_stat_columns(reaction_query)
|
||||||
reaction_query = reaction_query.group_by(Reaction.id)
|
reaction_query = reaction_query.group_by(Reaction.id, Author.id, Shout.id)
|
||||||
|
|
||||||
result = session.execute(reaction_query).unique().first()
|
result = session.execute(reaction_query).unique().first()
|
||||||
if result:
|
if result:
|
||||||
r, commented_stat, rating_stat = result
|
r, author, shout, commented_stat, rating_stat = result
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
|
||||||
if not r or not author:
|
if not r or not author:
|
||||||
return {"error": "Invalid reaction ID or unauthorized"}
|
return {"error": "Invalid reaction ID or unauthorized"}
|
||||||
|
|
||||||
|
|
|
@ -141,9 +141,10 @@ class SearchService:
|
||||||
if isinstance(result, dict):
|
if isinstance(result, dict):
|
||||||
mapping = result.get(self.index_name, {}).get("mappings")
|
mapping = result.get(self.index_name, {}).get("mappings")
|
||||||
logger.info(f"Найдена структура индексации: {mapping['properties'].keys()}")
|
logger.info(f"Найдена структура индексации: {mapping['properties'].keys()}")
|
||||||
if mapping and mapping["properties"].keys() != expected_mapping["properties"].keys():
|
expected_keys = expected_mapping["properties"].keys()
|
||||||
|
if mapping and mapping["properties"].keys() != expected_keys:
|
||||||
logger.info(f"Ожидаемая структура индексации: {expected_mapping}")
|
logger.info(f"Ожидаемая структура индексации: {expected_mapping}")
|
||||||
logger.warn("[!!!] Требуется переиндексация всех данных")
|
logger.warning("[!!!] Требуется переиндексация всех данных")
|
||||||
self.delete_index()
|
self.delete_index()
|
||||||
self.client = None
|
self.client = None
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user