schema-fix
All checks were successful
deploy / deploy (push) Successful in 1m17s

This commit is contained in:
2023-11-26 15:37:22 +03:00
parent 6134b02c4a
commit 391958e60c
3 changed files with 8 additions and 15 deletions

View File

@@ -7,18 +7,18 @@ from services.rediscache import redis
async def handle_reaction(notification: dict[str, str | int]):
"""создаеёт новое хранимое уведомление"""
try:
with local_session() as session:
with local_session() as session:
try:
n = Notification(**notification)
session.add(n)
session.commit(n)
except Exception as e:
session.rollback()
print(f"[listener.handle_reaction] error: {str(e)}")
except Exception as e:
session.rollback()
print(f"[listener.handle_reaction] error: {str(e)}")
async def reactions_worker():
async for message in redis.listen("reaction"):
msg = json.loads(message["data"])
msg = json.loads((await message).get("data", ""))
if msg:
await handle_reaction(msg)